Skip to content
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

Error resolving bookmark to RAR archive: Error Domain=NSCocoaErrorDomain Code=4 "The file doesn’t exist." #111

Open
luisangelsm opened this issue Apr 22, 2023 · 0 comments

Comments

@luisangelsm
Copy link

luisangelsm commented Apr 22, 2023

I have found a crash when trying to extract RAR files with this library.

Steps to reproduce issue (Detailed enough for me to reproduce - attaching a sample archive can be very helpful):

Sadly it is not easy to reproduce, it is something that happens using iTunes on Windows, transferring a file to an app using "File Sharing" and the file name contains some unicode characters, e.g. û.

What you expect to happen:

The file is extracted.

What actually happened:

A crash.

A stack trace or crash report, if you have one:

The problem happens when - (NSURL *)fileURL fails to get the URL in

NSURL *result = [NSURL URLByResolvingBookmarkData:self.fileBookmark
                                                                                  options:0
                                                                       relativeToURL:nil
                                                          bookmarkDataIsStale:&bookmarkIsStale
                                                                                     error:&error];

The method returns nil and that nil ends in - (BOOL)_unrarOpenFile:(NSString *)rarFile inMode:(NSInteger)mode withPassword:(NSString *)aPassword error:(NSError * __autoreleasing *)error causing a crash here self.flags->ArcName = strdup(rarFile.UTF8String);

The library should check if rarFile is nil to avoid the crash.

BUT, it would be nice to find and fix the underlying error that causes NSURL URLByResolvingBookmarkData to fail with Error Domain=NSCocoaErrorDomain Code=4 "The file doesn’t exist."

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant