fix: correct malformed gallery URLs in admin panel View Gallery links
Fixed issue where full URLs in share_link field were incorrectly being prepended with `/gallery/` prefix, resulting in malformed URLs like: `/gallery/http://localhost:3000/gallery/event-slug/token` The fix now properly handles both formats stored in the database: - Full URLs (from adminEvents.js): Used directly - Relative paths (from events.js): Prepended with `/gallery/` This ensures View Gallery links work correctly regardless of which backend endpoint created the event. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -363,7 +363,11 @@ export const EventDetailsPage: React.FC = () => {
|
|||||||
)}
|
)}
|
||||||
{event.share_link && (
|
{event.share_link && (
|
||||||
<a
|
<a
|
||||||
href={event.share_link}
|
href={
|
||||||
|
event.share_link.startsWith('http')
|
||||||
|
? event.share_link
|
||||||
|
: `/gallery/${event.share_link}`
|
||||||
|
}
|
||||||
target="_blank"
|
target="_blank"
|
||||||
rel="noopener noreferrer"
|
rel="noopener noreferrer"
|
||||||
className="inline-flex items-center gap-2 px-3 py-1.5 text-sm font-medium text-primary-600 hover:text-primary-700 border border-primary-600 rounded-lg hover:bg-primary-50 transition-colors"
|
className="inline-flex items-center gap-2 px-3 py-1.5 text-sm font-medium text-primary-600 hover:text-primary-700 border border-primary-600 rounded-lg hover:bg-primary-50 transition-colors"
|
||||||
|
|||||||
@@ -479,7 +479,11 @@ export const EventsListPage: React.FC = () => {
|
|||||||
</button>
|
</button>
|
||||||
{event.share_link ? (
|
{event.share_link ? (
|
||||||
<a
|
<a
|
||||||
href={event.share_link}
|
href={
|
||||||
|
event.share_link.startsWith('http')
|
||||||
|
? event.share_link
|
||||||
|
: `/gallery/${event.share_link}`
|
||||||
|
}
|
||||||
target="_blank"
|
target="_blank"
|
||||||
rel="noopener noreferrer"
|
rel="noopener noreferrer"
|
||||||
className="w-full text-left px-4 py-2 text-sm text-neutral-700 hover:bg-neutral-100 flex items-center gap-2"
|
className="w-full text-left px-4 py-2 text-sm text-neutral-700 hover:bg-neutral-100 flex items-center gap-2"
|
||||||
|
|||||||
Reference in New Issue
Block a user