Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions lib/download.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -680,15 +680,17 @@ function ftp_file_size($url) {
}

function url_filename($url) {
(Split-Path $url -Leaf).split('?') | Select-Object -First 1
# eclipse-mat mirror auto selected parameter "&r=1"
# regularly, "&" should be a part of URL
(Split-Path $url -Leaf).split('?').Split('&') | Select-Object -First 1
}

function url_remote_filename($url) {
# Unlike url_filename which can be tricked by appending a
# URL fragment (e.g. #/dl.7z, useful for coercing a local filename),
# this function extracts the original filename from the URL.
$uri = (New-Object URI $url)
$basename = Split-Path $uri.PathAndQuery -Leaf
$basename = url_filename $url
If ($basename -match '.*[?=]+([\w._-]+)') {
$basename = $matches[1]
}
Expand Down