Skip to content

Conversation

laszlo-san
Copy link

  • Add URL detection using new URL() constructor
  • Return absolute URLs as-is without prepending base URL
  • Maintain backward compatibility for relative paths
  • Add documentation with examples

Fixes URL malformation in production environments where Strapi Cloud returns full URLs (e.g., https://domain.media.strapiapp.com/image.jpg) instead of relative paths, preventing double-prefixing with base URL.

Types of changes

  • Bug fix (a non-breaking change which fixes an issue)
  • New feature (a non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Description

On self hosted/local dev environments Strapi returns relative paths for media resources, Strapi Cloud hovewer returns an absolute path, thus the url useStrapiMedia would return will be something like https://{strapiURL}/https://{domain}.media.strapiapp.com/path

Checklist:

  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have added tests to cover my changes (if not applicable, please state why)

- Add URL detection using new URL() constructor
- Return absolute URLs as-is without prepending base URL
- Maintain backward compatibility for relative paths
- Add documentation with examples

Fixes URL malformation in production environments where Strapi Cloud returns
full URLs (e.g., https://domain.media.strapiapp.com/image.jpg) instead
of relative paths, preventing double-prefixing with base URL.
Copy link

netlify bot commented Jul 7, 2025

👷 Deploy request for nuxt-strapi-module pending review.

Visit the deploys page to approve it

Name Link
🔨 Latest commit 18fbfe9

Copy link

vercel bot commented Jul 7, 2025

@laszlo-san is attempting to deploy a commit to the NuxtLabs Team on Vercel.

A member of the Team first needs to authorize it.

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