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

[Bug] ".txt" is added at the end of the filename downloaded by Brave Android #355

Closed
AnthillSudoku opened this issue Dec 12, 2024 · 2 comments · Fixed by #381
Closed

[Bug] ".txt" is added at the end of the filename downloaded by Brave Android #355

AnthillSudoku opened this issue Dec 12, 2024 · 2 comments · Fixed by #381
Labels
bug Something isn't working transfer

Comments

@AnthillSudoku
Copy link

Describe the bug
".txt" is added at the end of the filename when downloading some files with Brave Android (at the receiving end).
This happens only with some filename's extensions or no extension at all.

Here few extensions I tested:

affected extensions:
.kdbx / .backup / no extension

non affected extension:
.jpg / .pdf / .webm / .txt

To Reproduce
Steps to reproduce the behavior:

  1. Go to pairdrop.net
  2. Send a .kdbx file to the android device with Brave (or one of the affected)
  3. download the file with Brave
  4. open the file manager and check the extension

Expected behavior
filename is unchanged

Desktop (please complete the following information):

  • OS: debian 12
  • Browser Firefox
  • Version 128.5.0esr

Smartphone (please complete the following information):

  • Device: samsung a52q
  • OS: eOS (LineageOS)
  • Browser Brave
  • Version 1.73.97

Bug occurs on official PairDrop instance https://pairdrop.net/
Yes
Version: v1.10.10

@AnthillSudoku AnthillSudoku added the bug Something isn't working label Dec 12, 2024
@schlagmichdoch
Copy link
Owner

Thanks for the bug report.

Seemingly, this is done by the browser, maybe as a convenience feature to prevent people from downloading "broken" files?

The appending of ".txt" when there is no extension present is also done by Desktop Chromium 129.
I have no idea whether I can prevent the browser from adding a extension and will look into it.

Apart from that, PairDrop wrongly uses the complete name as the file extension when showing the ReceiveDialogs.
These lines need to check if there is a point at all like:

        const fileNameSplit = fileName.split('.');
        const fileExtension = fileNameSplit.length > 1
            ? '.' + fileNameSplit[fileNameSplit.length - 1]
            : '';

@schlagmichdoch
Copy link
Owner

I have no idea whether I can prevent the browser from adding a extension and will look into it.

Apparently, adding the mime type application/octet-stream to files that lack a mime type does the trick. Otherwise chromium seemingly assumes that the file is a text file and adds a ".txt" automatically.

Feel free to test whether it works as expected on this instance: https://pairdrop-dev.onrender.com

schlagmichdoch added a commit that referenced this issue Feb 19, 2025
## Fixes
- Fix PWA install button on chromium based browsers (#383) (Thanks @realchrislovett)
- Fix wrong file extension on chromium based browsers if mime type is not set (#355)

## Languages
- Translations updates from Hosted Weblate (Japanese)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working transfer
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants