* Correctly proccess paths with brackets.

This commit is contained in:
Justin Maggard 2012-03-28 06:43:28 +00:00
parent 252bc00cad
commit 29738ed064
2 changed files with 7 additions and 7 deletions

View File

@ -602,8 +602,8 @@ inotify_remove_directory(int fd, const char * path)
/* Invalidate the scanner cache so we don't insert files into non-existent containers */ /* Invalidate the scanner cache so we don't insert files into non-existent containers */
valid_cache = 0; valid_cache = 0;
remove_watch(fd, path); remove_watch(fd, path);
sql = sqlite3_mprintf("SELECT ID from DETAILS where PATH glob '%q/*'" sql = sqlite3_mprintf("SELECT ID from DETAILS where (PATH > '%q/' and PATH <= '%q/%c')"
" UNION ALL SELECT ID from DETAILS where PATH = '%q'", path, path); " or PATH = '%q'", path, path, 0xFF, path);
if( (sql_get_table(db, sql, &result, &rows, NULL) == SQLITE_OK) ) if( (sql_get_table(db, sql, &result, &rows, NULL) == SQLITE_OK) )
{ {
if( rows ) if( rows )
@ -620,7 +620,7 @@ inotify_remove_directory(int fd, const char * path)
} }
sqlite3_free(sql); sqlite3_free(sql);
/* Clean up any album art entries in the deleted directory */ /* Clean up any album art entries in the deleted directory */
sql_exec(db, "DELETE from ALBUM_ART where PATH glob '%q/*'", path); sql_exec(db, "DELETE from ALBUM_ART where (PATH > '%q/' and PATH <= '%q/%c')", path, path, 0xFF);
return ret; return ret;
} }

View File

@ -200,16 +200,16 @@ check_for_captions(const char * path, sqlite_int64 detailID)
/* If we weren't given a detail ID, look for one. */ /* If we weren't given a detail ID, look for one. */
if( !detailID ) if( !detailID )
{ {
id = sql_get_text_field(db, "SELECT ID from DETAILS where PATH glob '%q.*'" id = sql_get_text_field(db, "SELECT ID from DETAILS where (PATH > '%q.' and PATH <= '%q.z')"
" and MIME glob 'video/*' limit 1", file); " and MIME glob 'video/*' limit 1", file, file);
if( id ) if( id )
{ {
//DEBUG DPRINTF(E_DEBUG, L_METADATA, "New file %s looks like a caption file.\n", path); //DPRINTF(E_MAXDEBUG, L_METADATA, "New file %s looks like a caption file.\n", path);
detailID = strtoll(id, NULL, 10); detailID = strtoll(id, NULL, 10);
} }
else else
{ {
//DPRINTF(E_DEBUG, L_METADATA, "No file found for caption %s.\n", path); //DPRINTF(E_MAXDEBUG, L_METADATA, "No file found for caption %s.\n", path);
goto no_source_video; goto no_source_video;
} }
} }