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

Issue with Downloaded PDF Filename in Android DuckDuckGo Browser #4612

Closed
jeeva-sil opened this issue Jun 5, 2024 · 2 comments
Closed

Issue with Downloaded PDF Filename in Android DuckDuckGo Browser #4612

jeeva-sil opened this issue Jun 5, 2024 · 2 comments

Comments

@jeeva-sil
Copy link

jeeva-sil commented Jun 5, 2024

Describe the bug

I'm trying to download a PDF file with a specific name using HTML and JavaScript. The file is correctly named "myFile.pdf" in the code, but when I download it using the DuckDuckGo browser on an Android device, the file is saved with a random string as its name, such as "f7160bf-07aa-4c50-8765-f3651a345g675.pdf". How can I ensure the file is downloaded with the specified name?

How to Reproduce

Code:
Here's the code I'm using to convert a base64 string to a PDF file and download it:

`

<script>
    document.getElementById('downloadBtn').addEventListener('click', function() {
        const base64Data = 'your-base64-string-here'; // replace with your base64 string
        const byteCharacters = atob(base64Data);
        const byteNumbers = new Array(byteCharacters.length);
        for (let i = 0; i < byteCharacters.length; i++) {
            byteNumbers[i] = byteCharacters.charCodeAt(i);
        }
        const byteArray = new Uint8Array(byteNumbers);
        const blob = new Blob([byteArray], { type: 'application/pdf' });
        const link = document.createElement('a');
        link.href = window.URL.createObjectURL(blob);
        link.download = 'myFile.pdf';
        link.click();
    });
</script>

`

Steps to Reproduce:
Open the above code in a browser.
Click the "Download PDF" button.
Observe the downloaded file name.
Expected Behavior:
The file should download with the name "myFile.pdf".

this is hosted site please check this : https://tempad-51491.web.app/

Actual Behavior:
The file downloads with a random string as its name (e.g., "f7160bf-07aa-4c50-8765-f3651a345g675.pdf").

Additional Information:
This issue occurs specifically on the DuckDuckGo browser on Android.
The code works fine in other browsers (e.g., Chrome, Firefox).

Questions:
Why is the DuckDuckGo browser on Android renaming the file?
How can I ensure the file downloads with the correct name in the DuckDuckGo browser?
Any help or guidance would be greatly appreciated!

Expected behavior

The file should download with the name "myFile.pdf".

Environment

- DDG App Version: 5.202.0
- Device: Nokia 6.1 Plus
- OS: Android 10
Copy link

github-actions bot commented Jun 5, 2024

Thank you for opening an Issue in our Repository.
The issue has been forwarded to the team and we'll follow up as soon as we have time to investigate.
As stated in our Contribution Guidelines, requests for feedback should be addressed via the Feedback section in the Android app.

@jeeva-sil jeeva-sil changed the title [Bug] <title> Issue with Downloaded PDF Filename in Android DuckDuckGo Browser Jun 5, 2024
@lmac012
Copy link
Contributor

lmac012 commented Jun 6, 2024

Thank you for submitting this report and providing detailed steps to reproduce the issue. We are aware of this problem; however, we are currently limited by the existing WebView API, which doesn’t surface the filename to us in the case of blob URLs, such as the one your code generates.

@lmac012 lmac012 closed this as completed Jun 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants