Skip to content
This repository has been archived by the owner on Jul 23, 2019. It is now read-only.

Questionable URL construction #34

Open
vokal-isaac opened this issue Jul 21, 2016 · 2 comments
Open

Questionable URL construction #34

vokal-isaac opened this issue Jul 21, 2016 · 2 comments

Comments

@vokal-isaac
Copy link
Contributor

vokal-isaac commented Jul 21, 2016

From

//Since we're converting to an NSURL, use percent-escape encoding or spaces will crash.
path = [path stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
//Make sure to skip hidden files
NSArray *folderContents = [self.fileManager contentsOfDirectoryAtURL:[NSURL URLWithString:path]
includingPropertiesForKeys:@[NSURLNameKey]
options:NSDirectoryEnumerationSkipsHiddenFiles
error:&folderError];
:

    //Since we're converting to an NSURL, use percent-escape encoding or spaces will crash.
    path = [path stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding];

    //Make sure to skip hidden files
    NSArray *folderContents = [self.fileManager contentsOfDirectoryAtURL:[NSURL URLWithString:path]
                                              includingPropertiesForKeys:@[NSURLNameKey]
                                                                 options:NSDirectoryEnumerationSkipsHiddenFiles
                                                                   error:&folderError];

This should probably be something like:

    //Make sure to skip hidden files
    NSArray *folderContents = [self.fileManager contentsOfDirectoryAtURL:[NSURL fileURLWithPath:path]
                                              includingPropertiesForKeys:@[NSURLNameKey]
                                                                 options:NSDirectoryEnumerationSkipsHiddenFiles
                                                                   error:&folderError];

(h/t @bryanluby)

@designatednerd
Copy link
Contributor

@vokal-isaac @bryanluby Open a PR then 😄

@vokal-isaac
Copy link
Contributor Author

This was mostly a reminder for whenever someone has the time to validate it and open that PR.

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

No branches or pull requests

2 participants