Skip to content

Fix file uploads to honor updateEndpoint configuration setting - #209

Merged
grantcopley merged 2 commits into
nextfrom
copilot/fix-9c043918-27ff-4906-bd0f-7424ab50c0ed
Sep 24, 2025
Merged

Fix file uploads to honor updateEndpoint configuration setting#209
grantcopley merged 2 commits into
nextfrom
copilot/fix-9c043918-27ff-4906-bd0f-7424ab50c0ed

Conversation

Copilot AI commented Sep 24, 2025

Copy link
Copy Markdown
Contributor

Fixes an issue where file uploads would not respect the updateEndpoint configuration setting, causing uploads to use hardcoded paths instead of the configured endpoint pattern.

Problem

When a custom updateEndpoint is configured (e.g., /index.bxm/cbwire/update), file uploads would still use the hardcoded /cbwire/upload path instead of deriving the correct upload endpoint (/index.bxm/cbwire/upload) from the configuration.

This created inconsistency where:

  • Update requests correctly used: http://127.0.0.1:54220/index.bxm/cbwire/update
  • File uploads incorrectly used: http://127.0.0.1:54220/cbwire/upload
  • File uploads should use: http://127.0.0.1:54220/index.bxm/cbwire/upload

Root Cause

The generateSignedUploadURL() method in CBWIREController.cfc was hardcoding the upload path:

return local.baseURL & "/cbwire/upload?expires=" & local.expires & "&signature=" & urlEncodedFormat( local.signature );

Solution

  1. Added getUploadEndpoint() method - Derives the upload endpoint from the configured update endpoint by replacing /update with /upload

  2. Updated generateSignedUploadURL() method - Now uses the derived endpoint instead of hardcoded path:

// Before
return local.baseURL & "/cbwire/upload?expires=" & local.expires & "&signature=" & urlEncodedFormat( local.signature );

// After  
local.uploadEndpoint = getUploadEndpoint();
return local.baseURL & local.uploadEndpoint & "?expires=" & local.expires & "&signature=" & urlEncodedFormat( local.signature );
  1. Added comprehensive tests - Validates default behavior, custom endpoint derivation, and signed URL generation

Behavior

  • Default: updateEndpoint = "/cbwire/update" → upload endpoint = "/cbwire/upload"
  • Custom: updateEndpoint = "/index.bxm/cbwire/update" → upload endpoint = "/index.bxm/cbwire/upload"

The fix maintains backward compatibility while ensuring file uploads respect the same routing configuration as update requests.

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • downloads.ortussolutions.com
    • Triggering command: curl -fsSL REDACTED (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

Fixes #207


💬 Share your feedback on Copilot coding agent for the chance to win a $200 gift card! Click here to start the survey.

Co-authored-by: grantcopley <1197835+grantcopley@users.noreply.github.com>
Copilot AI changed the title [WIP] File uploads do not honor the setting set in the 'updateEndpoint' configuration setting. Fix file uploads to honor updateEndpoint configuration setting Sep 24, 2025
Copilot AI requested a review from grantcopley September 24, 2025 17:36

@grantcopley grantcopley left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

@copilot Looks great

@grantcopley
grantcopley marked this pull request as ready for review September 24, 2025 17:41
@grantcopley
grantcopley merged commit ed38a34 into next Sep 24, 2025
1 check passed
@grantcopley grantcopley added this to the v5.0 milestone Oct 9, 2025
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