! Please note that this is a snapshot of our old Bugzilla server, which is read only since May 29, 2020. Please go to gitlab.xfce.org for our new server !
BUG: Thunar SendTo Email doesn't detects files that are already archives
Status:
RESOLVED: FIXED

Comments

Description Sergey Ponomarev 2019-09-02 14:44:06 CEST
When user selects few files to send then internally sendto checks that all files are already archives and if not it shows a dialog window to ask to compress the files (see tse_ask_compress function).
The content type is checked on the line plugins/thunar-sendto-email/main.c:170

          /* determine the content type */
          content_type = g_file_info_get_content_type (tse_data->info);

The problem that the content_type is always resolved to NULL so in fact it never detects archives and always asks to compress multiple files even if they are already compressed.


Steps to Reproduce:
1. create two text files and compress them:
$ cd ~/
$ touch hello1.txt
$ touch hello2.txt
$ gzip -k hello1.txt
$ gzip -k hello2.txt
$ ls
hello1.txt  hello1.txt.gz hello2.txt  hello2.txt.gz
2. Run Thunar's sendto-email and send the two gzipped files:
/usr/local/lib/Thunar/thunar-sendto-email hello1.txt.gz  hello2.txt.gz

Expected Results:
Files are just attached.

Actual Results:
A dialog shown "Send 2 files as compressed archive?"

I'll attach patches with the fix and small refactoring as comments because I don't now how to attach multiple patch files:
But you can also see it on github  https://github.com/stokito/thunar/tree/sendto_fix_content_type
Comment 1 Sergey Ponomarev 2019-09-02 14:45:00 CEST
Created attachment 8980 
refactoring
Comment 2 Sergey Ponomarev 2019-09-02 14:47:26 CEST
Created attachment 8981 
0002-sendto-plugin-extract-function-tse_file_is_archive.patch
Comment 3 Sergey Ponomarev 2019-09-02 14:49:31 CEST
Created attachment 8982 
actual fix
Comment 4 alexxcons editbugs 2019-09-03 22:40:44 CEST
Thanks for the patches !

They fix the bug and look fine for me !

> .. because I don't now how to attach multiple patch files:
git format-patch -3 --stdout > multi_commit.patch

I'll push them to 4.14 branch and master
Comment 5 Git Bot editbugs 2019-09-03 22:48:18 CEST
Sergey Ponomarev referenced this bugreport in commit 0c74c71708f0736b397713ddc7d574445e380953

sendto plugin: move g_file_info_get_content_type() call out of the cycle (Bug #15916)

https://git.xfce.org/xfce/thunar/commit?id=0c74c71708f0736b397713ddc7d574445e380953
Comment 6 Git Bot editbugs 2019-09-03 22:48:20 CEST
Sergey Ponomarev referenced this bugreport in commit 3ecc5abcf76251795944b8050c302326995584fe

sendto plugin: extract function tse_file_is_archive (Bug #15916)

https://git.xfce.org/xfce/thunar/commit?id=3ecc5abcf76251795944b8050c302326995584fe
Comment 7 Git Bot editbugs 2019-09-03 22:48:22 CEST
Sergey Ponomarev referenced this bugreport in commit e4d2d218a58601a6272262a3a604aaeecd6aa2cc

sendto plugin: fix content type resolution. (Bug #15916)

https://git.xfce.org/xfce/thunar/commit?id=e4d2d218a58601a6272262a3a604aaeecd6aa2cc
Comment 8 Git Bot editbugs 2019-09-03 22:50:42 CEST
Sergey Ponomarev referenced this bugreport in commit 57fa316d24ced0cbc6536469700a45697b5893aa

sendto plugin: move g_file_info_get_content_type() call out of the cycle (Bug #15916)

https://git.xfce.org/xfce/thunar/commit?id=57fa316d24ced0cbc6536469700a45697b5893aa
Comment 9 Git Bot editbugs 2019-09-03 22:50:45 CEST
Sergey Ponomarev referenced this bugreport in commit a74764160cd34f2a8669f6fe9a25967439e53aa8

sendto plugin: extract function tse_file_is_archive (Bug #15916)

https://git.xfce.org/xfce/thunar/commit?id=a74764160cd34f2a8669f6fe9a25967439e53aa8
Comment 10 Git Bot editbugs 2019-09-03 22:50:47 CEST
Sergey Ponomarev referenced this bugreport in commit a432b8dd6800cbc3331d54511c56b444fd4fafa9

sendto plugin: fix content type resolution. (Bug #15916)

https://git.xfce.org/xfce/thunar/commit?id=a432b8dd6800cbc3331d54511c56b444fd4fafa9
Comment 11 Sergey Ponomarev 2019-09-04 08:46:27 CEST
Tnank you. I had ad idea that it is possible to have multiple commits in a single patch file but I wasn't unable to google this so decided that this is not possible. It also would be nice to add the multi commit patch to the guide https://docs.xfce.org/contribute/dev/git/start
I did everything by the guide.
But to be honest I spent twice more time to prepare the patch and create the ticket in Bugzilla then actual fix.
I'm not so expirienced developer but I did a lot of contribution just on GitHub and for me it's more convinent and clear.
If XFCE project had concideration to move to GitHub or self hosted GitLab then this will much more simplify contribution for those like me.
Comment 12 alexxcons editbugs 2019-09-04 22:12:46 CEST
> It also would be nice to add the multi commit patch to the guide 
Good idea .. done

Our Infra plans to move to a self hosted gitlab soon .. hope till end of the year. We will see.  (Besides that, there is a github mirror: https://github.com/xfce-mirror .. though I dont know if everybody can open pull requests there)

Bug #15916

Reported by:
Sergey Ponomarev
Reported on: 2019-09-02
Last modified on: 2019-09-04

People

Assignee:
Xfce Bug Triage
CC List:
1 user

Version

Attachments

refactoring (1.63 KB, patch)
2019-09-02 14:45 CEST , Sergey Ponomarev
no flags
0002-sendto-plugin-extract-function-tse_file_is_archive.patch (2.53 KB, patch)
2019-09-02 14:47 CEST , Sergey Ponomarev
no flags
actual fix (1.26 KB, patch)
2019-09-02 14:49 CEST , Sergey Ponomarev
no flags

Additional information