From 4079ca6387377112f6075a893d1ff1f2764b79c9 Mon Sep 17 00:00:00 2001 From: Danny Weinberg Date: Sun, 18 Aug 2019 23:13:29 -0700 Subject: [PATCH] Treat download links as non-file URLs (#89) This allows the file-type determination to correctly ignore the fragment (part after the `#`) in the URL, plus it's more correct, since the URL *isn't* a file path. --- Sources/RepoToolsCore/RepoActions.swift | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Sources/RepoToolsCore/RepoActions.swift b/Sources/RepoToolsCore/RepoActions.swift index f2161a66..183da2c3 100644 --- a/Sources/RepoToolsCore/RepoActions.swift +++ b/Sources/RepoToolsCore/RepoActions.swift @@ -401,7 +401,7 @@ public enum RepoActions { } let downloadsDir = shell.tmpdir() - let url = NSURL(fileURLWithPath: urlString) + let url = NSURL(string: urlString)! let fileName = url.lastPathComponent! let download = downloadsDir + "/" + podName + "-" + fileName guard let wwwUrl = NSURL(string: urlString).map({ $0 as URL }), @@ -434,7 +434,7 @@ public enum RepoActions { ), ]) } - fatalError("Cannot extract files other than .zip, .tar, .tar.gz, or .tgz") + fatalError("Cannot extract files other than .zip, .tar, .tar.gz, or .tgz. Got \(lowercasedFileName)") } assertCommandOutput(extract(), message: "Extraction of \(podName) failed")