Skip to content

Fix sync for raw files whose display name has no extension - #124

Open
TalLevAmi wants to merge 1 commit into
masterfrom
fix/sync-raw-file-extension
Open

TalLevAmi wants to merge 1 commit into
masterfrom
fix/sync-raw-file-extension

Conversation

@TalLevAmi

Copy link
Copy Markdown
Contributor

In dynamic folder mode, a raw file such as notes.txt gets a display name with no extension (notes), and a public ID with the extension (abc123.txt). _display_path used the display name as is for raw assets. The result:

  • sync --push did not match the local notes.txt with the remote asset, so it uploaded the file again on each run. Each upload made a new asset.
  • sync --pull saved the file as notes, with no extension.

I saw both problems on a live test cloud. After this change, a second --push skips the file and --pull saves notes.txt.

Brief Summary of Changes

  • _display_path (cloudinary_cli/utils/api_utils.py): for raw assets, add the extension of the public ID when the display name does not already end with it (case-insensitive). The fetch behavior does not change.
  • Unit tests for _display_path cover image, raw with and without an extension in the display name, and raw with no extension.

What does this PR address?

  • GitHub issue (Add reference - #XX)
  • Refactoring
  • New feature
  • Bug fix
  • Adds more tests

Are tests included?

  • Yes
  • No

Reviewer, please note:

  • A display name that already has the extension (for example an asset uploaded with -o display_name notes.txt) does not change.
  • Fixed folder mode does not use _display_path for matching, so it does not change.

Checklist:

  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I ran the full test suite before pushing the changes and all the tests pass.

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.py and test_cli_config_oauth.py fail with stderr not separately captured on this branch and on master too. These tests need Click 8.2, which needs Python 3.10 or later. CI must confirm the full result.

🤖 Generated with Claude Code

In dynamic folder mode, the display name of an uploaded raw file does not
include the extension (`notes`), but the public ID does
(`abc123.txt`). `_display_path` used the display name as is, so:

- `sync --push` did not match local `notes.txt` with the remote asset
  and uploaded it again on every run;
- `sync --pull` saved the file as `notes`, with no extension.

For raw assets, add the public ID extension to the display name when the
display name does not already end with it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@TalLevAmi
TalLevAmi marked this pull request as ready for review September 26, 2026 16:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant