fix: add slash separator in buildUrl for legacy id option (fixes #163)#164
Open
roomote-v0[bot] wants to merge 5 commits intomainlinefrom
Open
fix: add slash separator in buildUrl for legacy id option (fixes #163)#164roomote-v0[bot] wants to merge 5 commits intomainlinefrom
roomote-v0[bot] wants to merge 5 commits intomainlinefrom
Conversation
Author
Review completed. 2 issues were resolved in this commit.
Mention @roomote in a comment to request specific changes to this pull request or fix all unresolved issues. |
ggoranov-smar
approved these changes
Apr 6, 2026
smar-kaloyan-gangov
approved these changes
Apr 7, 2026
| const baseUrl = options.baseUrl || process.env.SMARTSHEET_API_HOST || 'https://api.smartsheet.com/2.0/'; | ||
| if (options.id) { | ||
| return baseUrl + options.url + options.id; | ||
| return baseUrl + options.url + '/' + options.id; |
Contributor
There was a problem hiding this comment.
don't we have to check if options.url is undefined too? I can imagine us ending with url like https://api.smartsheet.com/2.0/undefined/123
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR attempts to address Issue #163 by adding a slash separator in the buildUrl function when using the legacy
{ id: ... }option.Changes
lib/utils/httpRequestor.jsto add/separator betweenoptions.urlandoptions.idtest/functional/sheets.spec.tsto verify legacy{ id: ... }syntax works correctlyBackground
In v4.7.2, trailing slashes were removed from API URLs, but the buildUrl function had a fallback path that concatenated
options.url + options.idwithout a slash separator. This caused malformed URLs likesheets{sheetid}instead ofsheets/{sheetid}for code using the legacy{ id: sheetId }syntax.Solution
This fix maintains backward compatibility with code using the legacy
{ id: sheetId }syntax while preserving the v4.7.2 API URL structure without trailing slashes.Feedback and guidance are welcome!