Skip to content

Commit

Permalink
fix: encode the URL Scheme to avoid JLRoutes routing failures
Browse files Browse the repository at this point in the history
  • Loading branch information
tisfeng committed Dec 15, 2023
1 parent bf7b790 commit 2a10c13
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions Easydict/App/AppDelegate+EZURLScheme.m
Original file line number Diff line number Diff line change
Expand Up @@ -86,9 +86,12 @@ - (NSString *)extractQueryTextFromURL:(NSURL *)URL {

- (void)handleURLEvent:(NSAppleEventDescriptor *)event withReplyEvent:(NSAppleEventDescriptor *)replyEvent {
NSString *urlString = [[event paramDescriptorForKeyword:keyDirectObject] stringValue];
// PopClip text does not encode #, we need to encode it manually.
urlString = [urlString stringByReplacingOccurrencesOfString:@"#" withString:@"%23"];
NSURL *URL = [NSURL URLWithString:urlString];
/**
hello, #girl, good
We need to encode the URL to avoid JLRoutes routing failures.
*/
NSURL *URL = [NSURL URLWithString:urlString.encode];

// easydict://query?text=good
if ([URL.scheme containsString:EZEasydictScheme]) {
Expand Down

0 comments on commit 2a10c13

Please sign in to comment.