Changeset 4820

Show
Ignore:
Timestamp:
06/05/07 11:35:04 (1 year ago)
Author:
morris
Message:

When searching the index and the user has a root directory, make sure we only match stuff inside that directory

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • wired/trunk/wired/files.c

    r4766 r4820  
    687687        wi_string_t             *string; 
    688688        wd_account_t    *account; 
    689         wi_range_t              range
     689        wi_range_t              range, pathrange
    690690        wi_uinteger_t   i = 0, pathlength, index; 
    691691         
     
    724724                         
    725725                        if(wi_string_index_of_string_in_range(string, query, WI_STRING_CASE_INSENSITIVE, range) != WI_NOT_FOUND) { 
    726                                 wi_string_delete_characters_to_index(string, index + pathlength + 1); 
    727                                  
    728                                 wd_reply(420, WI_STR("%@"), string); 
     726                                if(account->files) { 
     727                                        pathrange.location = index + 1; 
     728                                        pathrange.length = wi_string_length(string) - pathrange.location; 
     729                                         
     730                                        if(wi_string_index_of_string_in_range(string, account->files, WI_STRING_CASE_INSENSITIVE, pathrange) == pathrange.location) { 
     731                                                wi_string_delete_characters_to_index(string, index + pathlength + 1); 
     732                                                 
     733                                                wd_reply(420, WI_STR("%@"), string); 
     734                                        } 
     735                                } else { 
     736                                        wi_string_delete_characters_to_index(string, index + 1); 
     737                                         
     738                                        wd_reply(420, WI_STR("%@"), string); 
     739                                } 
    729740                        } 
    730741                }