Learn how to make the most out of the Dropbox Community here 💙. 

Forum Discussion

Jon B.1's avatar
Jon B.1
Collaborator | Level 9
6 years ago

Filenames beginning with dot not found

I've been working with the SwiftyDropbox API, and until recently everything was fine.

But some time in the past few months, I'm now getting incorrect results when I search for a filename that begins with a dot:

 

        client?.files.search(path: searchPath, query: ".empfs1.xml").response(queue: DispatchQueue.global(qos: .utility), completionHandler: { response, error in

            if let response = response as Files.SearchResult? {

                if response.matches.count == 0 {

                    print("No file file found for \(searchPath)")

                    return

                }

            } else if let error = error {

                print("Dropbox server error searching \(searchPath)")

                self.handleResponseError(error)

                return

            }

            print("file .empfs1.xml FOUND for \(searchPath)")

        })

 

This code will *not* find .empfs1.xml if it exists.  Leave off the leading dot, it's fine. new.empfs1.xml is fine.  .empfs1 isn't.  The files beginning with the dots are definitely there, both on the website and in the local folder, but search won't find them.

I dunno; has something changed on the server end of the API recently, perhaps something to do with regular-expression matching?

 

  • Jon B.1's avatar
    Jon B.1
    Collaborator | Level 9

    Further update:  this behavior is visible through the HTTP endpoints as well, using the API Explorer, so it's not a Swift problem.

    It would appear to be a server-side bug in regular-expression handling.  Note that searching for "\.empfs1.xml" does find .empfs1.xml -- and also empfs1.xml (without the dot) and new.empfs1.xml. So I suppose I can work around this by checking the multiple results to see if one is actually valid...

    • Greg-DB's avatar
      Greg-DB
      Icon for Dropbox Staff rankDropbox Staff

      Thanks for the report! Are you still seeing this now? I just tried uploading a file named ".empfs1.xml" and I was able to find it by searching via the API with a query ".empfs1.xml", so it could have been a transient issue.

      If you are still seeing this problem though, please open an API ticket with the following additional details so we can check on this for you:

      • the affected account ID(s)
      • the 'searchPath' value you're using
      • the search results you get
      • the full path of the '.empfs1.xml' file that you expect but is missing from the results

      Thanks in advance! 

      (By the way, to clarify, the "query" parameter does not support regular expressions.)