Skip to content

Commit

Permalink
Update Optimize-BTImageSource.ps1
Browse files Browse the repository at this point in the history
Better replacement of URL to filename to prevent cache collisions in case filename would be the same.
  • Loading branch information
KelvinTegelaar committed Jul 17, 2020
1 parent aaf1dd8 commit e07f1e2
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion BurntToast/Private/Optimize-BTImageSource.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ function Optimize-BTImageSource {
)

if ([bool]([System.Uri]$Source).IsUnc -or $Source -like 'http?://*') {
$RemoteFileName = "$(get-random -min 0 -max 100000)" +$Source.Split('/\')[-1] -replace '[\[\]*?]',''
$RemoteFileName = $Source -replace '/|:', '-'

$NewFilePath = '{0}\{1}' -f $Env:TEMP, $RemoteFileName

Expand Down

0 comments on commit e07f1e2

Please sign in to comment.