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

feat(cogify): ensure cogify path-like args have trailing slashes. BM-858 #2903

Merged
merged 1 commit into from
Aug 22, 2023

Conversation

ajacombs
Copy link
Contributor

Description

What does this change aim to achieve?

Updates the cogify CLI commands to ensure that arguments representing folder paths have trailing slashes. Adds a UrlFolder parser for cmd-ts which parses the input string as a URL, and appends a trailing slash if it's missing. Changing the type from string to URL (via the Url or new UrlFolder parsers) involved changing places that use these values to construct other paths. Where these are passed to fsa functions, these are converted back to strings using urlToString.

Intention

Why is this change being made? What implications or other considerations are there?

Parts of the cogify commands were using strings for paths, while other parts were using URLs. This led to a situation where a string path was created by fsa.joinAll() which did not have a trailing slash, which was then passed to the URL constructor, resulting in a URL one directory higher than intended being created, which prevented finding the STAC collection.json file.

The calls to urlToString will be unnecessary once we upgrade to chunkd v11 which swaps to receiving URLs directly, however that is a much larger piece of work so for the time being we'll continue to gradually migrate to using URLs and use urlToString as needed when passing values to fsa functions.

Checklist

If not applicable, provide explanation of why.

  • Tests updated, N/A: no existing tests to update.
  • Docs updated
  • Issue linked in Title

@ajacombs ajacombs requested a review from a team as a code owner August 21, 2023 23:15
@ajacombs ajacombs added this pull request to the merge queue Aug 22, 2023
Merged via the queue into master with commit f6b35ed Aug 22, 2023
10 checks passed
@ajacombs ajacombs deleted the feat/cogify-trailing-slash branch August 22, 2023 00:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants