-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Fix #3397 #3398
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
Fix #3397 #3398
Conversation
|
(Update: Solved) Hi, I tried to run the tests for this project (before editing any code) on Windows but failed. As I am not familiar to npm, can anyone advises what happened and how I could fix this here? It then shows the following log / error: All the tests failed with the exactly same reason. I also tried I guessed it's a basic setup issue but I have no idea how to go on. Appreciate for any help. |
|
I think you might need to use |
|
You can always check out the job log in the travis build to find out what command was executed for running test: |
|
Thanks for helping. I have finished this PR and checked that it fixed #3397 under Windows. Awaiting review. |
|
|
||
| openExternal (href) { | ||
| try { | ||
| const success = shell.openExternal(href) || shell.openExternal(decodeURI(href)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the Link should always be encoded on creation and always decoded for onclick. Otherwise it could cause problems with edge cases when a non-encoded file looks like encoded. For example, if you have two files in the same directory:
- %E6%B8%AC%E8%A9%A6.txt
- %25E6%25B8%25AC%25E8%25A9%25A6.txt
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As it seems the original behavior was fine under mac os, and the issue seems to be Windows-only, I made it conservative that it prioritized original behavior. If you can confirm that "always decoding" works fine under each os, I'm happy to change to that case.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@hiiwave would you consider testing it under Windows with always decoding? I am currently testing it on Linux.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Always decoding behaves exactly as this implementation under Windows, because shell.openExternal(href) does not work thus it will always do shell.openExternal(decodeURI(href)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can confirm that "always decoding" works fine under Linux.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@hiiwave ok, I was assuming edge cases on Windows that make shell.openExternal(href) succeed. If it doesn't then it is ok.
If you create a storage location in the folder %20 both raw and decoded will fail because it must be encoded:
shell.openExternal(encodeURI(href)
works in this case. I don't know where href is stored but it must be encoded on creation.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As #3397 (comment):
IMHO, users should not create a folder named %20 in any case. I don't think anyone will ever do it as well.
|
@Rokt33r can you confirm this work on Windows as well? |
|
Will do. |
|
Confirmed it works. @hiiwave Thanks for the contribution! |
Description
This is trying to fix #3397.
(Update: Done)
This is working in progress. Since I have little experience building electron app, I haven't tried if this solution really works.I can try to build it and confirm later.Issue fixed
#3397
Type of changes
Checklist: