fix: NativeFile access for file URI when importing files on iOS, closes #1746 (#1747)

This commit is contained in:
Huang Xin
2025-08-06 00:48:42 +08:00
committed by GitHub
parent b2a71da2b0
commit 847d514441
2 changed files with 3 additions and 6 deletions
+1 -1
View File
@@ -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",
@@ -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).