fix: resolve frontend lint errors

This commit is contained in:
Lan
2026-06-03 19:41:08 +08:00
parent 8e7806c462
commit a58fc43d94
2 changed files with 8 additions and 3 deletions
+2 -2
View File
@@ -632,13 +632,13 @@ export function useAdminFiles() {
const storage = detail.storage
const expiredAt = policy?.expiredAt ?? policy?.expired_at ?? file.expired_at ?? null
const expiredCount = policy?.expiredCount ?? policy?.expired_count ?? file.expired_count ?? null
const prefixedName = `${file.prefix || ''}${file.suffix || ''}`
const displayName =
detail.displayName ??
detail.display_name ??
detail.filename ??
file.name ??
`${file.prefix}${file.suffix}` ??
file.code
(prefixedName || file.code)
const normalizedFile: FileListItem = {
...file,
name: displayName,
+6 -1
View File
@@ -2,6 +2,11 @@ import { saveAs } from 'file-saver'
import type { AdminFileViewItem, ApiResponse, ReceivedFileRecord } from '@/types'
import { buildDownloadUrl } from '@/utils/share-url'
const unsafeFilenamePattern = new RegExp(
`[\\\\/:*?"<>|${String.fromCharCode(0)}-${String.fromCharCode(31)}]`,
'g'
)
export function downloadReceivedRecord(record: ReceivedFileRecord): void {
if (record.downloadUrl) {
window.open(buildDownloadUrl(record.downloadUrl), '_blank')
@@ -16,7 +21,7 @@ export function downloadReceivedRecord(record: ReceivedFileRecord): void {
export const getSafeFilename = (name: string) =>
name
.replace(/[\\/:*?"<>|\x00-\x1F]/g, '_')
.replace(unsafeFilenamePattern, '_')
.replace(/\s+/g, ' ')
.trim()
.slice(0, 180) || 'download'