BoostIO / BoostNote-Legacy

This repository is outdated and new Boost Note app is available! We've launched a new Boost Note app which supports real-time collaborative writing. https://github.com/BoostIO/BoostNote-App
Other
17.07k stars 1.47k forks source link

can not preview local pics in 0.11.13 #2834

Closed zzxxhhzxh closed 5 years ago

zzxxhhzxh commented 5 years ago

Current behavior

Can not show the pics(jpg,bmp,gif,svg) by markdown which is OK in previous version. But images by website is OK.

new bitmap image

![Google_2015_logo.svg](:storage\65473ce7-2769-4949-ad80-e348f9f261c6\e78c79d4.svg) Does not show image.

![](https://upload.wikimedia.org/wikipedia/commons/2/2f/Google_2015_logo.svg) Does show image.

Expected behavior

Can show local images.

Steps to reproduce

Drag local pics to notes.

Environment

XarisA commented 5 years ago

I am experiencing the same issue. I added a comment here https://github.com/BoostIO/Boostnote/issues/1988#issuecomment-457833469 .

Skovisen commented 5 years ago

A quick temporary fix for this is to change the last non-trailing slash ( \ ) to a trailing slash ( / ). This worked for me on Windows.

So in the case of ![Google_2015_logo.svg](:storage\65473ce7-2769-4949-ad80-e348f9f261c6\e78c79d4.svg) change it to ![Google_2015_logo.svg](:storage\65473ce7-2769-4949-ad80-e348f9f261c6/e78c79d4.svg)

When this issue is resolved, remember to modify this back to it's original state, or it might cause issues in loading the images properly.

XarisA commented 5 years ago

A quick fix for this is to change the last non-trailing slash ( \ ) to a trailing slash ( / ). This worked for me on Windows.

So in the case of ![Google_2015_logo.svg](:storage\65473ce7-2769-4949-ad80-e348f9f261c6\e78c79d4.svg) change it to ![Google_2015_logo.svg](:storage\65473ce7-2769-4949-ad80-e348f9f261c6/e78c79d4.svg)

That seem to work but it is possible to result in error after the issue is resolved. So maybe we should just wait.

Skovisen commented 5 years ago

A quick fix for this is to change the last non-trailing slash ( \ ) to a trailing slash ( / ). This worked for me on Windows. So in the case of ![Google_2015_logo.svg](:storage\65473ce7-2769-4949-ad80-e348f9f261c6\e78c79d4.svg) change it to ![Google_2015_logo.svg](:storage\65473ce7-2769-4949-ad80-e348f9f261c6/e78c79d4.svg)

That seem to work but it is possible to result in error after the issue is resolved. So maybe we should just wait.

Yea, that's why I said it's a quick fix. I guess a better word is temporary, I'll edit my original comment.

ehhc commented 5 years ago

@daiyam @Rokt33r can you have a look at this? I've reverted the change breaking the attachemnts because i still don't understand what they do.. Furthermore i tried to let the tests test both linux and windows path separator

daiyam commented 5 years ago

@ehhc the function fixLocalURLS works on the HTML code so the \ should be generated as %5C. Is it the case? I don't have a working windows so I was unable to test it. I did assume the tests were correct (mdurl.encode(path.win32.sep)).

ehhc commented 5 years ago

The problem is the regex only matched the first '\' not the following ones (separating the noteKey).. Nonetheless: i don't understand why the expression has to be that complicated instead of the simple form present before (and after my PR)... I completed the tests so that they test with a noteKey as well.

daiyam commented 5 years ago

@ehhc what is the generated html? The simpler regex assumes that an image path was terminated by an " which is no longer the case due to the added gallery block.

daiyam commented 5 years ago

@ehhc I found the error in the regex, pretty stupid :sob: And thanks you for the updated tests (they are failing correctly with the bad regex)

Rokt33r commented 5 years ago

We're trying to fix this now. After it fixed, I will release new version as soon as possible.

zzxxhhzxh commented 5 years ago

I found the new problem, if I drag "Google_2015_logo.svg" to note, it will show like below

![Google_2015_logo.svg](:storage\6547f261c6\e78c79d4.svg)

But if I try to locate and open the file "e78c79d4.svg", I will find it is a png format image. So I have to change the extension and change the markdown sentense with "new splash" to

![Google_2015_logo.svg](:storage\6547261c6/e78c79d4.png)

Now it will work. This only happens in svg format. Png, jpg work well.

ehhc commented 5 years ago

@zzxxhhzxh i think that's another idependent problem.. Could you open a new issue for it?

daiyam commented 5 years ago

@zzxxhhzxh if you look at your jpg, you will see that in reality, it's an png. When pasting or dropping an image, Boostnote tries to fix its rotation (PR #2322), to do that, it converts the image as png... Ideally, there should be an option to disable this behaviour. You should open a new issue if you would like it to be fixed.

zzxxhhzxh commented 5 years ago

Yes, you're right. The problem is that boostnote did not change the extension for file. So it fails to show.

On Tue, Jan 29, 2019, 09:01 Baptiste Augrain notifications@github.com wrote:

@zzxxhhzxh https://github.com/zzxxhhzxh if you look at your jpg, you will see that in reality, it's an png. When pasting or dropping an image, Boostnote tries to fix its rotation (PR #2322 https://github.com/BoostIO/Boostnote/pull/2322), to do that, it converts the image as png... Ideally, there should be an option to disable this behaviour.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/BoostIO/Boostnote/issues/2834#issuecomment-458571968, or mute the thread https://github.com/notifications/unsubscribe-auth/AonuFfb9O47rfd4bSktDKhLC1vhntxBBks5vIGJMgaJpZM4aUNOk .

-- ZHOU Xiaohuan Tongji University, Texas A&M University - Kingsville

Rokt33r commented 5 years ago

It has been fixed v0.11.15. But, sadly, you have to install it manually because the auto updater in v0.11.13 is broken too... Please download it from https://github.com/BoostIO/boost-releases/releases/tag/v0.11.15.

llfung commented 5 years ago

The image now displays properly once updated from v0.11.13 to v0.11.15. However, since the update changes the "\" to"/", the photo is now not properly rendered in the exported html file.