Skip to content

Commit

Permalink
Use decoded path in error messages (#27)
Browse files Browse the repository at this point in the history
  • Loading branch information
richpryce authored May 16, 2024
1 parent dab035b commit de02e89
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 11 deletions.
4 changes: 2 additions & 2 deletions PlutoHelperAgent.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -390,7 +390,7 @@
INFOPLIST_FILE = PlutoHelperAgent/Info.plist;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks";
MACOSX_DEPLOYMENT_TARGET = 10.12;
MARKETING_VERSION = 3.4;
MARKETING_VERSION = 3.5.0;
PRODUCT_NAME = "$(TARGET_NAME)";
};
name = Debug;
Expand All @@ -404,7 +404,7 @@
INFOPLIST_FILE = PlutoHelperAgent/Info.plist;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks";
MACOSX_DEPLOYMENT_TARGET = 10.12;
MARKETING_VERSION = 3.4;
MARKETING_VERSION = 3.5.0;
PRODUCT_NAME = "$(TARGET_NAME)";
};
name = Release;
Expand Down
20 changes: 11 additions & 9 deletions PlutoHelperAgent/AppDelegate.m
Original file line number Diff line number Diff line change
Expand Up @@ -239,13 +239,15 @@ - (void)getUrl:(NSAppleEventDescriptor *)event

} else if ([action isEqualToString:@"openproject"]){
NSString *projectPath = [parts objectAtIndex:2];
NSString *decodedPath = [projectPath stringByReplacingPercentEscapesUsingEncoding:NSUTF8StringEncoding];


BOOL pathGood = [WhiteListProcessor checkIsInWhitelist:projectPath whiteListName:@"paths_list" prefix:true];
BOOL pathGood = [WhiteListProcessor checkIsInWhitelist:decodedPath whiteListName:@"paths_list" prefix:true];

BOOL extensionGood = [WhiteListProcessor checkIsInWhitelist:projectPath whiteListName:@"extensions_list" prefix:false];
BOOL extensionGood = [WhiteListProcessor checkIsInWhitelist:decodedPath whiteListName:@"extensions_list" prefix:false];

if (pathGood && extensionGood) {
NSArray *pathParts = [projectPath componentsSeparatedByString:@"?"];
NSArray *pathParts = [decodedPath componentsSeparatedByString:@"?"];
NSString *pathPartZero = [pathParts objectAtIndex:0];
if ((urlParams[@"premiereVersion"]) && (!urlParams[@"force"])) {
[self processVersion:urlParams[@"premiereVersion"] filePath:pathPartZero];
Expand All @@ -254,19 +256,19 @@ - (void)getUrl:(NSAppleEventDescriptor *)event
}
} else {
if (pathGood) {
NSLog(@"PlutoHelperAgent could not open the file at: %@ due to its extension not being in the white list.", projectPath);
NSLog(@"PlutoHelperAgent could not open the file at: %@ due to its extension not being in the white list.", decodedPath);
[self basicErrorMessage:@"Could not open file"
informativeText:[NSString stringWithFormat:@"The file at %@ could not be opened because its extension is not in the white list.\n\nPlease contact [email protected] if you see this error message.", projectPath]
informativeText:[NSString stringWithFormat:@"The file at %@ could not be opened because its extension is not in the white list.\n\nPlease contact [email protected] if you see this error message.", decodedPath]
];
} else if (extensionGood) {
NSLog(@"PlutoHelperAgent could not open the file at: %@ due to its path not being in the white list.", projectPath);
NSLog(@"PlutoHelperAgent could not open the file at: %@ due to its path not being in the white list.", decodedPath);
[self basicErrorMessage:@"Could not open file"
informativeText:[NSString stringWithFormat:@"The file at %@ could not be opened because its path is not in the white list.\n\nPlease contact [email protected] if you see this error message.", projectPath]
informativeText:[NSString stringWithFormat:@"The file at %@ could not be opened because its path is not in the white list.\n\nPlease contact [email protected] if you see this error message.", decodedPath]
];
} else {
NSLog(@"PlutoHelperAgent could not open the file at: %@ due to its path and extension not being in the correct white lists.", projectPath);
NSLog(@"PlutoHelperAgent could not open the file at: %@ due to its path and extension not being in the correct white lists.", decodedPath);
[self basicErrorMessage:@"Could not open file"
informativeText:[NSString stringWithFormat:@"The file at %@ could not be opened because its path and extension are not in the correct white lists.\n\nPlease contact [email protected] if you see this error message.", projectPath]
informativeText:[NSString stringWithFormat:@"The file at %@ could not be opened because its path and extension are not in the correct white lists.\n\nPlease contact [email protected] if you see this error message.", decodedPath]
];
}
}
Expand Down

0 comments on commit de02e89

Please sign in to comment.