Skip to content

fix: clear optional image uploader settings on import - #7225

Merged
pajlada merged 3 commits into
Chatterino:masterfrom
3r01:fix-uploader-import-stale-credentials
Sep 5, 2026
Merged

pajlada merged 3 commits into
Chatterino:masterfrom
3r01:fix-uploader-import-stale-credentials

Conversation

@3r01

@3r01 3r01 commented Sep 3, 2026 •

Copy link
Copy Markdown
Contributor

Importing an image uploader configuration does not replace Headers or DeletionURL when the imported configuration provides no values for them. This can cause an auth header from the previous config to be sent to the newly imported host.

Fixed by clearing optional uploader settings when they are not provided by the imported config

Added a test covering this

Steps to reproduce:

  1. Open Settings > External tools > Image Uploader
  2. Add an extra header, e.g. Authorization: Bearer ugandan-key and a deletion url
{
  "Version": "1.0.0",
  "RequestURL": "https://old.example/upload",
  "FileFormName": "file",
  "URL": "{response}",
  "DeletionURL": "https://old.example/delete/{delete-key}",
  "Headers": {
    "Authorization": "Bearer ugandan-key"
  }
}
  1. Import a new config that omits Headers and DeletionURL
{
  "Version": "1.0.0",
  "RequestURL": "https://new.example/upload",
  "FileFormName": "file",
  "URL": "{response}"
}
  1. Observe that the previous header and deletion url are still there

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

clang-tidy made some suggestions

Comment thread tests/src/ImageUploader.cpp Outdated
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
@pajlada
pajlada enabled auto-merge (squash) September 5, 2026 10:15
@pajlada
pajlada merged commit 018e05a into Chatterino:master Sep 5, 2026
18 checks passed
@3r01
3r01 deleted the fix-uploader-import-stale-credentials branch September 5, 2026 12:40
babicekmarek pushed a commit to babicekmarek/streamally-chatterino that referenced this pull request Sep 14, 2026
Importing an image uploader configuration does not replace `Headers` or
`DeletionURL` when the imported configuration provides no values for
them. This can cause an auth header from the previous config to be sent
to the newly imported host.

Fixed by clearing optional uploader settings when they are not provided
by the imported config

Reviewed-by: pajlada <rasmus.karlsson@pajlada.com>
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.

2 participants