Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Randomize the image name when it's dropped #667

Merged
merged 2 commits into from
Jul 2, 2017
Merged

Randomize the image name when it's dropped #667

merged 2 commits into from
Jul 2, 2017

Conversation

asmsuechan
Copy link
Contributor

@asmsuechan asmsuechan commented Jun 28, 2017

screen shot 2017-06-28 at 13 07 34

I changed an image name to a random string to avoid duplication when it's dropped. And remove encodeURI().

## before
![file%20name.jpg](/Users/asmsuechan/Boostnote/images/filename.jpg)

## after
![file name.jpg](/Users/asmsuechan/Boostnote/images/skgvvqw0ozbprpb9.jpg)

%20 changes to and filename changes to skgvvqw0ozbprpb9.

ref: #652

@samontea
Copy link

samontea commented Jun 28, 2017

What happens if there's a naming collision with the random name? Will this clobber (i.e. overwrite) the existing image?

@asmsuechan
Copy link
Contributor Author

Yes, it'll override for now. But it's very rare. So you should be delighted when it happens 😆

@asmsuechan asmsuechan merged commit a36be79 into BoostIO:master Jul 2, 2017
@asmsuechan asmsuechan deleted the randomize-image-name branch July 2, 2017 13:22
@kohei-takata kohei-takata mentioned this pull request Jul 29, 2017
@kazup01 kazup01 mentioned this pull request Jul 29, 2017
@th-lange
Copy link

1.) I think using a hash function (even md5) and do not overwirte on collisions would be better
Obv. sha512 would be less prone to collisions. but more expensive.

  1. This will not work on linux (ubuntu xenial / linux mint): it resolves the path to (example)
    file:///usr/share/boostnote/resources/app/lib/images9vdwtwps2e6irudi.jpg

Not shure why. But I am on Boostnote 0.8.12

@th-lange
Copy link

Quick and Dirty fix for single user:

sudo ln -s /home/<username-goes-here>/<note-folder-goes-here>/images images
so mine was:

sudo ln -s /home/letigre/Dropbox/Notes/images images

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants