fix: resolve frontend lint errors

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