@samitouri / QOSami-HFS / commits / 35c3187e

fix: admin/internet: link was wrong using roots and a base-address with :port

Massimo Melina committed Mar 23, 2024 at 15:49 UTC 35c3187e47f76f0662894ffebd6832a9575f4a86
1 file changed +3 -3
admin/src/FileForm.ts
+3 -3
@@ -290,7 +290,7 @@ interface LinkFieldProps extends FieldProps<string> {
290 function LinkField({ value, statusApi }: LinkFieldProps) {
291 const { data, reload, error } = statusApi
292 const urls: string[] = data?.urls.https || data?.urls.http
293 - const baseHost = data?.baseUrl && new URL(data.baseUrl).hostname
293 + const baseHost = data?.baseUrl && new URL(data.baseUrl).host
294 const root = useMemo(() => baseHost && _.find(data.roots, (root, host) => matches(baseHost, host)),
295 [data])
296 if (root)
@@ -311,7 +311,7 @@ function LinkField({ value, statusApi }: LinkFieldProps) {
311 label: "Link",
312 value: link || `outside of configured base address (${baseHost})`,
313 error,
314 - InputProps: { inputComponent: RenderLink },
314 + InputProps: link ? { inputComponent: RenderLink } : undefined,
315 end: h(Box, {},
316 h(IconBtn, {
317 icon: ContentCopy,
@@ -319,7 +319,7 @@ function LinkField({ value, statusApi }: LinkFieldProps) {
319 disabled: !link,
320 onClick: () => navigator.clipboard.writeText(link)
321 }),
322 - h(IconBtn, { icon: QrCode2, title: "QR Code", onClick: showQr }),
322 + h(IconBtn, { icon: QrCode2, title: "QR Code", onClick: showQr, disabled: !link }),
323 h(IconBtn, { icon: Edit, title: "Change", onClick() { changeBaseUrl().then(reload) } }),
324 )
325 }),