flameshot-org / flameshot

Powerful yet simple to use screenshot software :desktop_computer: :camera_flash:
https://flameshot.org
GNU General Public License v3.0
23.92k stars 1.52k forks source link

Cannot save captures when savePath basename starts with a dot (.) #3611

Open madduck opened 1 month ago

madduck commented 1 month ago

Flameshot Version

12.1.0

Installation Type

Linux, MacOS, or Windows Package manager (apt, pacman, eopkg, choco, brew, ...)

Operating System type and version

Debian unstable

Description

I used to have savePath set to ~/.tmp for the last couple of years. For a few weeks or months now, this no longer works:

% flameshot screen -n 0 -p ~/.tmp
flameshot: error: Error trying to save as /home/madduck/.tmp/2024-05-17-10-32-04-Screenshot.tmp

% ls -l /home/madduck/.tmp/2024-05-17-10-32-04-Screenshot.tmp
-rw-rw---- 1 madduck madduck 0 May 17 10:32 /home/madduck/.tmp/2024-05-17-10-32-04-Screenshot.tmp

but it works fine if I use any other directory that doesn't start with a dot, even if the directory itself is within a directory starting with a dot.

Steps to reproduce

% for i in .with-dot without-dot .with-dot/subdir without-dot/.dotted-subdir; do echo; mkdir -v $i; flameshot screen -n 0 -p ${PWD}/$i; done

mkdir: created directory '.with-dot'
flameshot: error: Error trying to save as …/.with-dot/2024-05-17-10-34-40-Screenshot.with-dot

mkdir: created directory 'without-dot'
flameshot: info: Capture saved as …/without-dot/2024-05-17-10-34-40-Screenshot.png

mkdir: created directory '.with-dot/subdir'
flameshot: info: Capture saved as …/subdir/2024-05-17-10-34-40-Screenshot.png

mkdir: created directory 'without-dot/.dotted-subdir'
flameshot: error: Error trying to save as …/without-dot/.dotted-subdir/2024-05-17-10-34-40-Screenshot.dotted-subdir

In the cases that flameshot fails, it creates a .tmp file in the directory just fine, but then failes to write to it, i.e. it stays at size==0.

Let me know if you need an strace, though I think you'll be able to reproduce this yourself.

Screenshots or screen recordings

No response

System Information

Debian unstable, triple screen setup using AwesomeWM on Xorg, but the same problem also exists on the laptop with just the laptop screen (same config otherwise).

Cyborgscode commented 2 weeks ago

https://bugzilla.redhat.com/show_bug.cgi?id=2291457

Happens on Fedora and ArchLinux as well.