mirror of
https://github.com/swisspol/GCDWebServer.git
synced 2026-04-05 00:04:17 +08:00
Ensure directories are always listed in deterministic order
macOS APIs have recently changed and do not return sorted entries for directories.
This commit is contained in:
@@ -239,7 +239,7 @@ NS_ASSUME_NONNULL_END
|
||||
}
|
||||
|
||||
NSError* error = nil;
|
||||
NSArray* contents = [[NSFileManager defaultManager] contentsOfDirectoryAtPath:absolutePath error:&error];
|
||||
NSArray* contents = [[[NSFileManager defaultManager] contentsOfDirectoryAtPath:absolutePath error:&error] sortedArrayUsingSelector:@selector(localizedStandardCompare:)];
|
||||
if (contents == nil) {
|
||||
return [GCDWebServerErrorResponse responseWithServerError:kGCDWebServerHTTPStatusCode_InternalServerError underlyingError:error message:@"Failed listing directory \"%@\"", relativePath];
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user