Skip to content

Commit

Permalink
fix: Lowercase package name in NuGet API query (#5)
Browse files Browse the repository at this point in the history
  • Loading branch information
James-LG authored Apr 22, 2022
1 parent 79509a2 commit 9bec5ef
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -97,17 +97,23 @@ class Action {

console.log(`Package Name: ${this.packageName}`)

https.get(`${this.nugetSource}/v3-flatcontainer/${this.packageName}/index.json`, res => {
let url = `${this.nugetSource}/v3-flatcontainer/${this.packageName.toLowerCase()}/index.json`
console.log(`Getting versions from ${url}`)
https.get(url, res => {
let body = ""

if (res.statusCode == 404)
if (res.statusCode == 404) {
console.log('404 response, assuming new package')
this._pushPackage(this.version, this.packageName)
}


if (res.statusCode == 200) {
res.setEncoding("utf8")
res.on("data", chunk => body += chunk)
res.on("end", () => {
const existingVersions = JSON.parse(body)
console.log(`Versions retrieved: ${existingVersions.versions}`)
if (existingVersions.versions.indexOf(this.version) < 0)
this._pushPackage(this.version, this.packageName)
})
Expand Down

0 comments on commit 9bec5ef

Please sign in to comment.