|
|
@ -4,7 +4,7 @@ import Image from "next/image"; |
|
|
import { type ReactNode, useCallback, useEffect, useId, useRef, useState } from "react"; |
|
|
import { type ReactNode, useCallback, useEffect, useId, useRef, useState } from "react"; |
|
|
import type { QuestionField } from "@/lib/schema-adapter"; |
|
|
import type { QuestionField } from "@/lib/schema-adapter"; |
|
|
import { useUploadTmpMediaMutation } from "@/hooks/marriage/use-upload-tmp-media"; |
|
|
import { useUploadTmpMediaMutation } from "@/hooks/marriage/use-upload-tmp-media"; |
|
|
import { resolveMediaUrl } from "@/lib/http"; |
|
|
|
|
|
|
|
|
import { getApiRequestUrl } from "@/lib/http"; |
|
|
import { isInFlutterWebView, uploadFile } from "@/lib/webview-actions"; |
|
|
import { isInFlutterWebView, uploadFile } from "@/lib/webview-actions"; |
|
|
import { useI18n } from "@/translations/provider"; |
|
|
import { useI18n } from "@/translations/provider"; |
|
|
import ErrorToast from "./error-toast"; |
|
|
import ErrorToast from "./error-toast"; |
|
|
@ -368,8 +368,23 @@ export function QuestionPhoto({ |
|
|
candidateUrl = storedValue.trim(); |
|
|
candidateUrl = storedValue.trim(); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
const displayUrl = hasImageError ? null : resolveMediaUrl(candidateUrl); |
|
|
|
|
|
const hasAnswer = Boolean(displayUrl && !hasImageError); |
|
|
|
|
|
|
|
|
// Display URL: absolute URLs (https://...) used directly; relative paths proxied via getApiRequestUrl.
|
|
|
|
|
|
// This matches yesterday's working logic — do NOT use resolveMediaUrl which forcefully proxies
|
|
|
|
|
|
// public /static/ URLs, breaking display on mobile where the proxy returns 502.
|
|
|
|
|
|
let displayUrl: string | null = null; |
|
|
|
|
|
if (candidateUrl) { |
|
|
|
|
|
if ( |
|
|
|
|
|
candidateUrl.startsWith("http://") || |
|
|
|
|
|
candidateUrl.startsWith("https://") || |
|
|
|
|
|
candidateUrl.startsWith("blob:") || |
|
|
|
|
|
candidateUrl.startsWith("data:") |
|
|
|
|
|
) { |
|
|
|
|
|
displayUrl = candidateUrl; |
|
|
|
|
|
} else { |
|
|
|
|
|
displayUrl = getApiRequestUrl(candidateUrl); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
const hasAnswer = Boolean(displayUrl); |
|
|
|
|
|
|
|
|
return ( |
|
|
return ( |
|
|
<div |
|
|
<div |
|
|
|