danestves / strapi-plugin-preview-content

A plugin for Strapi Headless CMS that provides content preview to integrate with any frontend
MIT License
64 stars 27 forks source link

Admin URL assumed to be /admin which breaks clone button when using a custom admin URL #32

Open julesrenaud opened 2 years ago

julesrenaud commented 2 years ago

I'm using custom admin URLs in production to make it harder to find the admin panel without knowing the URL. Doing so breaks the clone button on an entity's admin page (it's not an issue when clicking the icon on the collection type listing page.

I found the issue to be an hardcoded path in src/admin/main/preview-context/index.js

https://github.com/danestves/strapi-plugin-preview-content/blob/c0d5d2416452bd74a6837d097c85ee4492b89720/src/admin/main/preview-context/index.js#L290

The correct admin URL should be used instead. It could be retrieved via window.location.