Announcements
Do you have an idea for Dropbox Paper? Share it with us here!
Highlighted

Filenames beginning with dot not found

Helpful | Level 5

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?

 

2 Replies

Re: Filenames beginning with dot not found

Helpful | Level 5

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...

Reply
Loading...

Re: Filenames beginning with dot not found

Dropboxer

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.)

Reply
Loading...
API Support

Have a question? Our Dropbox Community is here to help you find an answer!
You won’t have to wait too long for a reply, but why not learn more about the Community while you’re here.

Not the right discussion for you? Find out what else our Community has to say about API Support.

Or, search our Help Center for even more.

Who's talking
Top contributors to this post