You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have scenarios where the total length of the file paths being extracted are too long for the system's maximum path length. Mostly with naming from languages outside of english. Anyway, before I make a PR, I was wondering if there is something I'm missing in the code that can supress this error or ideally can handle it properly?
Again, I am looking at the code and it doesn't look like it but, I can be blind sometimes, so I figured I'd ask before I start a PR.
And for the sake of clarity and example, I a check like this in rar.go:
funcMaxPathLength...// find the max path length based on the system and return it// or, if that's annoying, then just set the max to a const with some sane limit that works for all systems
func (x*XFile) unrar(rarReader*rardecode.ReadCloser) (int64, []string, error) {
...for {
header, err:=rarReader.Next()
...wfile:=x.clean(header.Name)
iflen(wfile) >MaxPathLength() {
// Skip the file with some warning or something...log.Warnf("Skipping file with long path: %s", wfile)
continue// Or, what woiuld be even better is truncate the file name somehow inside the archive...
}
}
}
Your library came in as a life saver for me, so thank you for your work! 👍
PS: if I do a PR, I'm thinking a handler for this so the user can handle the logic for dealing with it but I'm open to whatever you think would be best for your package.
The text was updated successfully, but these errors were encountered:
I was wondering if there is something I'm missing in the code
I've never hit a max length error, so never had to fix this problem.
You mentioned suppressing an error, but didn't provide one to suppress. You also asked about handling the error properly, but I'm not sure what that actually means. How that situation gets handled properly is likely subjective. The handler idea sounds ideal for this reason. We can work together to solve it, throw up a PR so we can collaborate.
I have scenarios where the total length of the file paths being extracted are too long for the system's maximum path length. Mostly with naming from languages outside of english. Anyway, before I make a PR, I was wondering if there is something I'm missing in the code that can supress this error or ideally can handle it properly?
Again, I am looking at the code and it doesn't look like it but, I can be blind sometimes, so I figured I'd ask before I start a PR.
And for the sake of clarity and example, I a check like this in rar.go:
Your library came in as a life saver for me, so thank you for your work! 👍
PS: if I do a PR, I'm thinking a handler for this so the user can handle the logic for dealing with it but I'm open to whatever you think would be best for your package.
The text was updated successfully, but these errors were encountered: