Skip to content

Commit

Permalink
possible fix for #910 (#911)
Browse files Browse the repository at this point in the history
* fix #910

* Update src/nimblepkg/publish.nim

Co-authored-by: Andreas Rumpf <rumpf_a@web.de>

* update detection algorithm

* quit if url is insecure

* raise exception instead of quit

* Update src/nimblepkg/publish.nim

Co-authored-by: Andreas Rumpf <rumpf_a@web.de>
Co-authored-by: Dominik Picheta <dominikpicheta@googlemail.com>
  • Loading branch information
3 people authored Jul 4, 2021
1 parent 8eca18a commit bdc9678
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/nimblepkg/publish.nim
Original file line number Diff line number Diff line change
Expand Up @@ -205,10 +205,17 @@ proc publish*(p: PackageInfo, o: Options) =
if url.endsWith(".git"): url.setLen(url.len - 4)
downloadMethod = "git"
let parsed = parseUri(url)

if parsed.scheme == "":
# Assuming that we got an ssh write/read URL.
let sshUrl = parseUri("ssh://" & url)
url = "https://" & sshUrl.hostname & "/" & sshUrl.port & sshUrl.path
elif parsed.username != "" or parsed.password != "":
# check for any confidential information
# TODO: Use raiseNimbleError(msg, hintMsg) here
raise newException(NimbleError,
"Cannot publish the repository URL because it contains username and/or password. Fix the remote URL. Hint: \"git remote -v\"")

elif dirExists(os.getCurrentDir() / ".hg"):
downloadMethod = "hg"
# TODO: Retrieve URL from hg.
Expand Down

0 comments on commit bdc9678

Please sign in to comment.