HBiSoft / PickiT

An Android library that returns real paths from Uri's
MIT License
292 stars 54 forks source link

Return wrong path #35

Closed HuuNguyen312 closed 3 years ago

HuuNguyen312 commented 3 years ago

Return wrong path

Expect Return path: xxx/KakaotalkDownload/filename

Can it be reproduced in demo app Yes

Device information

Screenshots

Screenshot_20210227-163755_PickiT example Screenshot_20210227-163730_My Files

HBiSoft commented 3 years ago

I downloaded KakaoTalk, downloaded a file I sent to myself and tested the path in the demo application. I get the correct path: /storage/emulated/0/KakaotalkDownload/test.mp4.

Please share your Intent. I see that you select a .pdf file, but the demo application gives you an option to select a video, so you must have changed the Intent.

HuuNguyen312 commented 3 years ago

This is my Intent

    private void openGallery() {
        //  first check if permissions was granted
        if (checkSelfPermission()) {
            Intent intent = new Intent();
            intent.setType("*/*");
            intent.setAction(Intent.ACTION_GET_CONTENT);
            intent.addCategory(Intent.CATEGORY_OPENABLE);
            intent.putExtra("return-data", true);
            intent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
            startActivityForResult(intent, SELECT_VIDEO_REQUEST);
        }
    }

This is block code in my case return Environment.getExternalStorageDirectory().toString() + "/Download/"+ fileName;

image

I tried using this file by another app (Telegram, kakaotalk, ...). This file can still be read and sent normally. I can add more log to any code if you need.

Thanks

HBiSoft commented 3 years ago

I was not able to reproduce this. Please download the original demo application (https://github.com/HBiSoft/PickiT/releases/download/0.1.14/PickiTDemo.apk) and select a video file instead of a pdf. Let me know what path you then get.

HBiSoft commented 3 years ago

Closing until more information (asked above) is provided.