Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Android] FileOpenPicker returns invalid file path for videos selected #16587

Open
arianeleonard opened this issue May 6, 2024 · 3 comments
Open
Assignees
Labels
difficulty/tbd Categorizes an issue for which the difficulty level needs to be defined. kind/bug Something isn't working triage/untriaged Indicates an issue requires triaging or verification

Comments

@arianeleonard
Copy link

Current behavior

When using FileOpenPicker's PickSingleFIleAsync or PickMultipleFIlesAsync and setting the SuggestedStartLocation property to PickerLocationId.VideosLibrary to select one or multiple videos, the path returned seems invalid on Android. When using FileInfo(string filename) to get the file information like the extension and size of the image, an exception is triggered for Android.

Expected behavior

FileOpenPicker's PickSingleFIleAsync and PickMultipleFIlesAsync should return a valid file path for videos selected.

How to reproduce it (as minimally and precisely as possible)

  1. Launch the app on Android VideoSelection.zip
  2. Select "Select videos" button
  3. Select some videos from the gallery and select "Add"
  4. Exception should be displayed

Workaround

No response

Works on UWP/WinUI

None

Environment

Uno.WinUI / Uno.WinUI.WebAssembly / Uno.WinUI.Skia

NuGet package version(s)

Uno WInUI : 5.2.108

Affected platforms

Android

IDE

Visual Studio 2022

IDE version

17.9.2

Relevant plugins

No response

Anything else we need to know?

No response

@arianeleonard arianeleonard added kind/bug Something isn't working triage/untriaged Indicates an issue requires triaging or verification difficulty/tbd Categorizes an issue for which the difficulty level needs to be defined. labels May 6, 2024
@jeromelaban
Copy link
Member

jeromelaban commented May 8, 2024

@arianeleonard paths returned by the file picker are supposed to be opaque (the path is not necessarily supposed to be useable through System.IO APIs). You should make a copy of the StorageFile you get through Windows.Storage APIs, such as FileIO and similar first, then make System.IO operations on that copy after.

Out of curiosity, why do you need to interact the file directly?

@arianeleonard
Copy link
Author

arianeleonard commented May 8, 2024

We use FileInfo to validate the extension and the size of the files selected and to use the OpenRead, OpenText and Open methods.

@MartinZikmund
Copy link
Member

@arianeleonard Which equivalent Windows.Storage APIs would solve your usecase? We should tackle this by implementing them so that it is transparent to the target platform.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
difficulty/tbd Categorizes an issue for which the difficulty level needs to be defined. kind/bug Something isn't working triage/untriaged Indicates an issue requires triaging or verification
Projects
None yet
Development

No branches or pull requests

4 participants