-
Notifications
You must be signed in to change notification settings - Fork 31
Fix backslashes in the url path causes an error #187
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 backslashes in the url path causes an error #187
Conversation
992df30 to
a5d8e86
Compare
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.
Hello,
we will not do it this way. This will break the possibility to use web urls as it will enforce local paths instead of allowing local, web and network share paths.
Please use Test-Path to check if the path is a local path and use \ for splitting and otherewise /
a5d8e86 to
561291c
Compare
|
I don't think that all local paths can be specified with backslash but also with a normal slash as @Nathaniel-Donahue described in the issue, so it would be better to just check if the url contains slash or backslash. |
|
It doesn't matter because the "fix" you provide will enforce a local path, because with your check testing for It doesnt matter if you are using C:\users\dummy\service.zipor https://example.com/binary.zipBecause you are always setting And therefor you are always enforcing this part: if ($CustomBinaryUrl) {
$ZipArchive = Join-Path -Path $TmpDirectory -ChildPath ($FrameworkServiceUrl.Split('\')[-1]);
}With the latest update, you check in addition for bachslashes in the path with if ($CustomBinaryUrl -and ($FrameworkServiceUrl.Contains('\'))) {The proper solution would be this block: if (Test-Path $FrameworkServiceUrl) {
$ZipArchive = Join-Path -Path $TmpDirectory -ChildPath ($FrameworkServiceUrl.Replace('/', '\').Split('\')[-1]);
} else {
$ZipArchive = Join-Path -Path $TmpDirectory -ChildPath ($FrameworkServiceUrl.Split('/')[-1]);
}The rest of the updated code can be removed. Because it doesn't matter on how you specify the local path: icinga> Test-Path C:\Users\dummy\
True
icinga> Test-Path C:/Users/dummy/
True
icinga> Test-Path '\\network_fileshare\Icinga'
True
icinga> Test-Path '//network_fileshare/Icinga'
True
icinga> Test-Path 'www.icinga.com'
False |
37ed48c to
df80f86
Compare
LordHepipud
left a comment
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.
LFTM
df80f86 to
76e8203
Compare
76e8203 to
0fdb3b1
Compare
resolves #186