Can't upload macOS screenshots with default filename due to no_double_extension check #1910

Closed
opened 2026-02-05 02:11:06 +03:00 by OVERLORD · 1 comment
Owner

Originally created by @abulgatz on GitHub (Oct 20, 2020).

Describe the bug
Mac screenshots taken with control + command + shift + 3 (or 4) are automatically saved to the desktop as a png with filename: Screen Shot YYYY-MM-DD at HH.MM.SS AM.png.

The extra periods in the filename fail the no_double_extension check the Bookstack runs on all uploaded images, so macOS screenshots can't be uploaded to Bookstack without renaming them.

Steps To Reproduce
Steps to reproduce the behavior:

  1. On macOS
  2. Take a screenshot with control + command + shift + 3 or control + command + shift + 4
  3. Edit any page in Bookstack
  4. Insert image
  5. Click to upload
  6. Try to upload the screenshot just taken from the Desktop
  7. Error: "The file must only have a single file extension"

Expected behavior
Bookstack shouldn't care about extra dots in a filename.

Screenshots
image

Additional context
I don't think there's any reason that Bookstack should care about periods in a filename. If Bookstack needs an extension, it's easy enough to grab any text after the last dot. Is there something that would break if the no_double_extension was just removed? I can't think of any other web or desktop apps that reject extra periods in a filename.

Originally created by @abulgatz on GitHub (Oct 20, 2020). **Describe the bug** Mac screenshots taken with <kbd>control</kbd> + <kbd>command</kbd> + <kbd>shift</kbd> + <kbd>3</kbd> (or <kbd>4</kbd>) are automatically saved to the desktop as a png with filename: `Screen Shot YYYY-MM-DD at HH.MM.SS AM.png`. The extra periods in the filename fail the `no_double_extension` check the Bookstack runs on all uploaded images, so macOS screenshots can't be uploaded to Bookstack without renaming them. **Steps To Reproduce** Steps to reproduce the behavior: 1. On macOS 2. Take a screenshot with <kbd>control</kbd> + <kbd>command</kbd> + <kbd>shift</kbd> + <kbd>3</kbd> or <kbd>control</kbd> + <kbd>command</kbd> + <kbd>shift</kbd> + <kbd>4</kbd> 2. Edit any page in Bookstack 3. Insert image 4. Click to upload 5. Try to upload the screenshot just taken from the Desktop 6. Error: "The file must only have a single file extension" **Expected behavior** Bookstack shouldn't care about extra dots in a filename. **Screenshots** <img width="200" alt="image" src="https://user-images.githubusercontent.com/1438193/96538723-d124ae80-125e-11eb-8576-639e356657de.png"> **Additional context** I don't think there's any reason that Bookstack should care about periods in a filename. If Bookstack needs an extension, it's easy enough to grab any text after the last dot. Is there something that would break if the `no_double_extension` was just removed? I can't think of any other web or desktop apps that reject extra periods in a filename.
OVERLORD added the :cat2:🐈 Possible duplicate label 2026-02-05 02:11:06 +03:00
Author
Owner

@ssddanbrown commented on GitHub (Dec 11, 2020):

Thanks for reporting this @abulgatz.
Since this is already open under #2217 I'm going to close this off as a duplicate.

The no_double_extension check is done on purpose to avoid a range of potential path-based attacks in addition to avoiding some potential attacks based off of how Apache can interpret some file name/extension formats.

It was a rather hastily added patch though when needing to do so in the name of security. As said in #2217, We could probably do better by just replacing/removing any additional periods within the name.

@ssddanbrown commented on GitHub (Dec 11, 2020): Thanks for reporting this @abulgatz. Since this is already open under #2217 I'm going to close this off as a duplicate. The `no_double_extension` check is done on purpose to avoid a range of potential path-based attacks in addition to avoiding some potential attacks based off of how Apache can interpret some file name/extension formats. It was a rather hastily added patch though when needing to do so in the name of security. As said in #2217, We could probably do better by just replacing/removing any additional periods within the name.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/BookStack#1910