question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Speed up the search process for available file names in findUniqueFilename

See original GitHub issue

If the user-chosen file name is occupied by an existing file, the app sequentially tries to find an available file name by trying suffixes _1, _2, etc. When there are hundreds of these numbered files, it will be unbearably slow. It already does for Test.jpg on the Beta Commons. I believe the same thing happens when the user uploads a lot of files under the same name.

Proposed solution:

Change the file name pattern from <user-given title>_<number>.jpg to <user-given title>_<short hash>.jpg when the user-chosen file name is unavailable. It should extend to a longer hash when collisions repeat. When that’s not enough (let’s say 3 consecutive collisions on random generation), we could add another 4, and repeat.

Steps to reproduce:

Build betaDebug and try uploading a file under the name Test. It will take a longer time (> 1 min in my WiFi environment) than it should.

Commons app version:

latest master

(Note: the task description has been rewritten based on feedback below.)

Issue Analytics

  • State:open
  • Created 5 years ago
  • Comments:16 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
madhurgupta10commented, Mar 5, 2019

@whym I can still work on the issue 😃

1reaction
maskaravivekcommented, Feb 25, 2019

I like the second approach but would like to suggest some modification in the upload flow.

Background context about current flow:

If the user chooses a title that already exists, we show a warning dialog informing the user that the title already exists and asking whether he wants to proceed or not.

If the user clicks on No > he stays on the same page and he can manually edit the title.

If the user clicks on Yes > he proceeds further and once the upload is queued, he would discover the actual title that was assigned to his upload.

It might surprise the user to see 1, 2, 3 etc (or based on the new discussion some hash) appended to the title. Will it be more fruitful to show the final title to the user(ie. on the upload screen itself) before he proceeds further. Seeing an unaesthetic title might encourage the user to actually update the title to something more meaningful.

Read more comments on GitHub >

github_iconTop Results From Across the Web

How To Use Find and Locate to Search for Files on Linux
The most obvious way of searching for files is by their name. To find a file by name with the find command, you...
Read more >
Find Files Faster: How to Organize Files and Folders - Zapier
Click the search button in your menu bar (or press CMD+Space), then type in the file or folder name you're looking for.
Read more >
Classic SysAdmin: How to Search for Files from the Linux ...
Let's get up to speed with the find command so you can take control ... It seemed simple; issue the command find FILENAME...
Read more >
Error message when you open or save a file in Microsoft Excel
In Microsoft Office Excel 2007, you may receive the following error message: '<Filename>.<extension>' could not be found. Check the spelling of the file...
Read more >
How to search for file names in Visual Studio? - Stack Overflow
This method is superior to the solution explorer search (which wastes space by showing both filenames and class names) in that it is...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found