Problem/Motivation

ImageKit accepts uploads whose file names contain spaces or non-ASCII characters and returns the URL unencoded, which is stored verbatim. At render time the ImageKit PHP SDK rejects that URL in its own validation and returns an error JSON string instead of throwing, which ends up as the rendered <source src>. Poster URLs are built by string concatenation and bypass validation entirely. The failure is invisible: the asset row stays ready and no error is logged or stored.

Steps to reproduce

  1. Upload a video named e.g. Test – Übersicht.mov to an ImageKit video style and let the sync finish.
  2. Render it: the source src contains {"error":"src is not a valid URL"} while the asset administration page shows the asset as synced without any error.

Proposed resolution

Transliterate remote file names to a safe ASCII set on upload. Percent-encode the stored source URL path when building delivery and poster URLs, which heals existing assets without re-uploading. Validate the SDK return value and throw a new ImageKitDeliveryException instead of passing error payloads through. Let the provider catch expected delivery failures, log them, store last_error on the affected asset row (only when the error changes, so render caches stay intact) and fall back to the local file or no poster.

Remaining tasks

Review and merge the prepared fix.

User interface changes

The asset administration page now shows delivery URL failures in the error column.

API changes

ImageKitDeliveryBuilder::buildDerivative() and ::buildPoster() now throw the new ImageKitDeliveryException for unusable source URLs. ImageKitSyncManager gains the core transliteration service as constructor dependency. Depends on the value object validation from #3616656: Invalid provider URLs can reach the rendered video markup.

Data model changes

None. Existing rows are healed at render time; new uploads get sanitized remote file names.

Comments

dpacassi created an issue. See original summary.

  • dpacassi committed 14f832fc on 1.0.x
    Issue #3616657 by dpacassi: Special characters in file names break...
dpacassi’s picture

Status: Active » Fixed

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.