Skip to content

Commit 7bd8ac5

Browse files
committed
Merge branch 'paracycle-feature/accept-non-file-uris'
2 parents d3fe4a3 + 21065dc commit 7bd8ac5

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

Terminal Notifier/AppDelegate.m

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -205,10 +205,12 @@ - (void)applicationDidFinishLaunching:(NSNotification *)notification;
205205

206206
- (NSImage*)getImageFromURL:(NSString *) url;
207207
{
208-
if(!contains(url, @"file://")){ // Prefix file:// if not present
208+
NSURL *imageURL = [NSURL URLWithString:url];
209+
if([[imageURL scheme] length] == 0){
210+
// Prefix 'file://' if no scheme
209211
url = [NSString stringWithFormat:@"%@%@", @"file://", url];
212+
imageURL = [NSURL URLWithString:url];
210213
}
211-
NSURL *imageURL = [NSURL URLWithString:url];
212214
return [[NSImage alloc] initWithContentsOfURL:imageURL];
213215
}
214216

0 commit comments

Comments
 (0)