From 847d514441cbc14bc8609428888da30ca704a8c4 Mon Sep 17 00:00:00 2001 From: Huang Xin Date: Wed, 6 Aug 2025 00:48:42 +0800 Subject: [PATCH] fix: NativeFile access for file URI when importing files on iOS, closes #1746 (#1747) --- apps/readest-app/package.json | 2 +- apps/readest-app/src/services/nativeAppService.ts | 7 ++----- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/apps/readest-app/package.json b/apps/readest-app/package.json index 19279407..f27b261f 100644 --- a/apps/readest-app/package.json +++ b/apps/readest-app/package.json @@ -1,6 +1,6 @@ { "name": "@readest/readest-app", - "version": "0.9.69", + "version": "0.9.70", "private": true, "scripts": { "dev": "dotenv -e .env.tauri -- next dev", diff --git a/apps/readest-app/src/services/nativeAppService.ts b/apps/readest-app/src/services/nativeAppService.ts index 324a36c2..e5a0f2ae 100644 --- a/apps/readest-app/src/services/nativeAppService.ts +++ b/apps/readest-app/src/services/nativeAppService.ts @@ -27,7 +27,7 @@ import { type as osType } from '@tauri-apps/plugin-os'; import { Book } from '@/types/book'; import { FileSystem, BaseDir, AppPlatform } from '@/types/system'; -import { getOSPlatform, isContentURI, isFileURI, isValidURL } from '@/utils/misc'; +import { getOSPlatform, isContentURI, isValidURL } from '@/utils/misc'; import { getCoverFilename, getFilename } from '@/utils/book'; import { copyURIToPath } from '@/utils/bridge'; import { NativeFile, RemoteFile } from '@/utils/file'; @@ -119,10 +119,7 @@ export const nativeFileSystem: FileSystem = { } } else { const prefix = await this.getPrefix(base); - if (isFileURI(path)) { - path = path.replace(/^file:\/\//, ''); - } - const absolutePath = path.startsWith('/') ? path : await join(prefix, path); + const absolutePath = path.startsWith('/') ? path : prefix ? await join(prefix, path) : null; if (absolutePath && OS_TYPE !== 'android') { // NOTE: RemoteFile currently performs about 2× faster than NativeFile // due to an unresolved performance issue in Tauri (see tauri-apps/tauri#9190).