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

Images lost after sync over git #2139

Closed
ytee opened this issue Jun 27, 2018 · 13 comments
Closed

Images lost after sync over git #2139

ytee opened this issue Jun 27, 2018 · 13 comments
Labels
bug 🐛 Issue concerns a bug.

Comments

@ytee
Copy link

ytee commented Jun 27, 2018

Current behavior

I use boostnotes on windows at work and on linux at home. I sync using git.
My routine is like this:

  1. Pull notes from git
  2. Edit notes
  3. Push notes to git

When I pull from git on linux machine, images do not appear.
The links appear correct. But the images are not present.
So I replaced the boostnotes storage content with files downloaded from git (as opposed to pull etc.). Still images are not displayed.

Expected behavior

I expect the notes to be same when I download / sync up with git on linux.
The images should be displayed if they are present in the attachments// folder.
Is my expectation correct?
Currently images are not displayed.

Steps to reproduce

  1. Edit notes on Windows, add some images from clipboard etc.
  2. Push the changes to git
  3. Pull in the changes from git on linux machine
  4. Launch boostnote.

Environment

  • Version :0.11.6
  • OS Version and name : Arch Linux
@sosukesuzuki sosukesuzuki added the bug 🐛 Issue concerns a bug. label Jun 28, 2018
@sosukesuzuki
Copy link
Member

@ytee Boostnote saves images in /storagepath/images . Did you include /images in your git repository?

@ytee
Copy link
Author

ytee commented Jun 28, 2018

@sosukesuzuki , yes I sync all the folders in git. My folder structure is as follows in both Windows, Linux & git:

  • boostnote.json
  • notes
  • attachments
    In attachments folder, I do have several folders with images.
    It works fine on windows. But on linux I can't see the images in boostnote even though the images are present.

@sosukesuzuki
Copy link
Member

@ytee Hmm..., I'll try to research this bug.

@stefan-jung
Copy link

I can confirm this issue.

@ehhc
Copy link
Contributor

ehhc commented Jul 2, 2018

Two questions:

  • are your images in :storageLocation/attachments or in :storageLocation/attachments/NOTEKEY where NOTEKEY is a hash string?
  • are you getting any errors in the developer console?

@stefan-jung
Copy link

stefan-jung commented Jul 2, 2018

The console shows

Failed to load resource: net::ERR_FILE_NOT_FOUND
File "/home/stefan/workspace/notes/attachments/b54522b5-fd1a-480a-9b75-27f583c6b22c
/2606db30.jpg" deleted because it was not included in the content of the note

Markdown is

![foo](:storage\b54522b5-fd1a-480a-9b75-27f583c6b22c\2606db30.jpg)

The image has been added by dragging it to the editor.

@stefan-jung
Copy link

any progress here?

@ehhc
Copy link
Contributor

ehhc commented Jul 11, 2018

Hi,
i think the problem is the following:

  1. the path how attachments are referenced in the markdown is platform dependent (stupid me..).
  2. When leaving a note (onBlur) the app tries to delete all attachments not referenced in the note (e.g. not needed anymore)
  3. because you use different platforms on windows your markdown reference contains \ as separators.. On linux the app expects /
  4. due to 3) the app don't recognizes the references in your markdown as attachments -> It deletes the actual attachments because it thinks they are not referenced (e.g. not needed).

Possible solution: make the delete-unused-attachments-feature possible to disable.. that would not fix the issue but at least would be a workaround..

Unfortunately i don't have that much time at the moment.. i will have a look when i can do it

@stefan-jung
Copy link

Thanks for the update, I'll keep my fingers crossed. 👍

@ytee
Copy link
Author

ytee commented Jul 11, 2018

@ehhc , Thanks for the update. I am just eager to have the work around for now because this is part of my regular workflow.

@saaguero
Copy link
Contributor

This should be a high-priority bug to resolve.

In order of priority, I would suggest to:

  • Disable this autoremove attachments feature.

    • It's not so nice to lose files... not just because of the platform dependent thing, but consider the case when you want to move the screenshot, you cut the text ":storage/foo/bar.png", and then there is a high chance you will lose the file because you didn't paste it on time (ie: onBlur event)
  • Use a cross-platform way to reference the file (ie: use always forward slash '/' and inside the code do the dirty-work to handle the final os.path)

  • Make this feature configurable (I would suggest leaving it off by default, but this is just a personal preference)

@stefan-jung
Copy link

Thanks @saaguero for #2205, I can confirm your fix works on Windows-Linux, too.

@ytee, could you please confirm as well and close this issue? Thanks a lot.

@ytee
Copy link
Author

ytee commented Jul 19, 2018

@xephon2, @saaguero I can confirm that it is working on linux. All the images that were missing before are now visible. I will confirm Windows' side of things tomorrow.
Thank you boostnote team & everyone involved for the awesome work !!

@Rokt33r Rokt33r closed this as completed Jul 20, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug 🐛 Issue concerns a bug.
Projects
None yet
Development

No branches or pull requests

6 participants