Skip to content

Add object detection, tracking, mobile notifications, and search to any security camera.

ignore query params in afileserver

roryclear40d8f7a2bbe2
diff --git a/clearcam/FileServer.m b/clearcam/FileServer.m
index 34e66f4..2fbbf56 100644
--- a/clearcam/FileServer.m
+++ b/clearcam/FileServer.m
@@ -153,15 +153,19 @@
return;
}
-
-
NSString *fullPath = [basePath stringByAppendingPathComponent:filePath];
+ NSRange queryRange = [fullPath rangeOfString:@"?"];
+ if (queryRange.location != NSNotFound) {
+ fullPath = [fullPath substringToIndex:queryRange.location];
+ }
+
BOOL isDirectory = NO;
if (![[NSFileManager defaultManager] fileExistsAtPath:fullPath isDirectory:&isDirectory]) {
dprintf(clientSocket, "HTTP/1.1 404 Not Found\r\n\r\n");
return;
}
+
if (isDirectory) { //todo, change url maybe
NSString *playerFilePath = [[NSBundle mainBundle] pathForResource:@"player" ofType:@"html"];
if (playerFilePath && [[NSFileManager defaultManager] fileExistsAtPath:playerFilePath]) {