-
Notifications
You must be signed in to change notification settings - Fork 333
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add sound flag checking to soundExists #3133
Conversation
lua/wire/server/wirelib.lua
Outdated
flags = nil | ||
end | ||
|
||
path = string.GetNormalizedFilepath(path) | ||
if istable(sound.GetProperties(path)) or file.Exists("sound/" .. path, "GAME") then |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Need to make sure sound.GetProperties doesn't accept the unallowed flags
lua/wire/server/wirelib.lua
Outdated
@@ -1537,9 +1537,20 @@ if not WireLib.PatchedDuplicator then | |||
end | |||
|
|||
function WireLib.SoundExists(path) | |||
path = string.GetNormalizedFilepath(string.gsub(string.sub(path, 1, 260), '["?]', '')) | |||
-- Limit length and remove invalid chars | |||
if #path>260 then path = string.sub(path, 1, 260) end |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there any reason for having this? iirc this was only put into place as a band aid fix for sounds too long for source to play, but since now there's file path checking isn't it unnecessary?
It seems like there were people who made use of sound emitters & e2 playing sounds that aren't on the server, maybe having a convar to disable the file checking would be good enough to please such people. |
I need to test if there's memory leaking issue with invalid paths. |
there is, that was the point of checking if the file exists. |
can probably make a per player limit of sound paths instead. not ideal but probably better |
@unknao Try this |
No description provided.