Fix search --csv file name when the name ends with .csv - #120
Merged
Merged
Conversation
`cld search ... --csv out.csv` wrote `out.csv.csv`, because the writer always added `.csv` to the name. - `write_json_list_to_csv` adds `.csv` only when the name does not already end with it (case-insensitive), and returns the file name. - `search` logs the real file name. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
On macOS and Windows, `out.CSV` and `out.csv` are the same file, so the directory listing had one file, not two. Remove the listing check. The check of the returned file name still finds the `out.csv.csv` bug. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.
cld search <query> --csv out.csvwrote the fileout.csv.csv. A script that readsout.csvafter the command fails. The log line showed the doubled name, but the help text says--csv <filename>.Brief Summary of Changes
write_json_list_to_csv(cloudinary_cli/utils/utils.py) adds.csvonly when the name does not end with.csv(case-insensitive). It returns the file name that it wrote.searchandsearch_folderslog that file name.--csv out, still givesout.csv, as before.What does this PR address?
Are tests included?
Reviewer, please note:
Checklist:
Local test run: I ran the full suite on Python 3.8 with Click 8.1.8. The new tests pass, and they fail without the fix. 8 tests in
test_cli_agent.pyandtest_cli_config_oauth.pyfail withstderr not separately capturedon this branch and onmastertoo. These tests need Click 8.2, which needs Python 3.10 or later. CI must confirm the full result.🤖 Generated with Claude Code