Но когда я открываю файл из других приложений, таких как Kakaotalk или Slack, и копирую это содержимое:/ / в файл://, который находится в каталоге кеша, возникает следующая ошибка.
Я пытался создать собственный модуль для вызова currentActivity.grantUriPermission(currentActivity .packageName, URI, Intent.FLAG_GRANT_READ_URI_PERMISSION), но это не сработало (java.lang.SecurityException: UID 10874 не имеет разрешения на содержимое)
код, в котором произошла ошибка
Код: Выделить всё
async function copySharedPathToUri(contentUri: string) {
const destinationUri = FileSystem.cacheDirectory + "tempFile";
await FileSystem.copyAsync({
from: contentUri,
to: destinationUri,
});
return destinationUri;
}
Код: Выделить всё
Error uploading file: [Error: Call to function 'ExponentFileSystem.copyAsync' has been rejected.
→ Caused by: java.lang.SecurityException: Permission Denial: reading androidx.core.content.FileProvider uri content://com.kakao.talk.FileProvider/external_files/emulated/0/Android/data/com.kakao.talk/contents/MTg=/2412.10468v1.pdf from pid=25200, uid=10858 requires the provider be exported, or grantUriPermission()]
Код: Выделить всё
+native-intent.ts
Код: Выделить всё
export function redirectSystemPath({
path,
initial,
}: {
path: string;
initial: string;
}) {
try {
console.log("redirectSystemPath", path, initial);
return `/?sharedPath=${encodeURIComponent(path)}`;
} catch {
return "/";
}
}
Код: Выделить всё
"dependencies": {
"@expo-google-fonts/inter": "^0.2.3",
"@expo/vector-icons": "^14.0.2",
"@react-native-async-storage/async-storage": "1.23.1",
"@react-navigation/native": "^7.0.0",
"axios": "^1.7.7",
"cookie": "^1.0.1",
"date-fns": "^4.1.0",
"expo": "~52.0.19",
"expo-apple-authentication": "~7.1.2",
"expo-build-properties": "~0.13.1",
"expo-constants": "~17.0.3",
"expo-dev-client": "~5.0.6",
"expo-document-picker": "~13.0.1",
"expo-file-system": "~18.0.6",
"expo-font": "~13.0.1",
"expo-image": "~2.0.3",
"expo-linking": "~7.0.3",
"expo-router": "~4.0.13",
"expo-share-intent": "^3.1.1",
"expo-splash-screen": "~0.29.18",
"expo-status-bar": "~2.0.0",
"expo-system-ui": "~4.0.6",
"expo-web-browser": "~14.0.1",
"nativewind": "^4.1.23",
"patch-package": "^8.0.0",
"react": "18.3.1",
"react-dom": "18.3.1",
"react-native": "0.76.5",
"react-native-gesture-handler": "~2.20.2",
"react-native-reanimated": "~3.16.1",
"react-native-safe-area-context": "4.12.0",
"react-native-screens": "^4.0.0",
"react-native-web": "~0.19.10",
"react-native-webview": "13.12.5",
"tailwindcss": "^3.4.14"
},
Код: Выделить всё

Подробнее здесь: https://stackoverflow.com/questions/792 ... d-when-ope