Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix go namespace slashes #886

Merged
merged 8 commits into from
Nov 12, 2021
Merged
Changes from 1 commit
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 routes/definitions.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,14 @@ async function getDefinition(request, response) {
const log = logger()
log.info('getDefinition route hit', { ts: new Date().toISOString(), requestParams: request.params })

let coordinates

// Painful way of handling go namespaces with multiple slashes
// Unfortunately, it seems the best option without doing a massive
// rearchitecture of the entire coordinate system
if (request.params.type == "go" && request.params.provider == "golang") {
if (request.params.type == 'go' && request.params.provider == 'golang') {
Copy link
Contributor

@MichaelTsengLZ MichaelTsengLZ Nov 12, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Possibly some lint rule is not set up very well.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Michael, do you mean that these should be triple equals to be the best JavaScript it can be? ===
(Agree if so)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch. the == should be ===. What I mean is the double quote can be caught by lint rules. I think == could also be caught in lint rules.

let namespaceNameRevision = utils.parseNamespaceNameRevision(request)
let splitString = namespaceNameRevision.split("/")
let splitString = namespaceNameRevision.split('/')

// Pull off the last part of the string as the revision
const revision = splitString.pop()
Expand Down