Project

General

Profile

Actions

Feature #44642

open

Include seconds in pasted image filenames so that they sort in paste order

Added by Go MAEDA 2 days ago. Updated about 23 hours ago.

Status:
New
Priority:
Normal
Assignee:
-
Category:
Attachments
Target version:
Resolution:

Description

When an image is pasted from the clipboard into a wiki text area, Redmine generates a filename such as the following:

clipboard-202610191803-bm9uy.png

The timestamp has a resolution of one minute only, and it is followed by five random characters. When a user pastes several screenshots one after another within the same minute, for example to describe the steps to reproduce a problem, their order cannot be determined from their filenames. After the attachments are downloaded, they cannot be sorted in the order in which they were pasted. Sorting by modification time does not help either, because downloaded files usually have the download time as their modification time.

This patch adds seconds to the timestamp:

clipboard-20261019180359-bm9uy.png

Since a person rarely pastes images more than once a second, a resolution of one second is sufficient to keep manually pasted images in paste order.

Notes:

  • Since the timestamp now includes seconds, I considered reducing the random part to three characters to keep the filename length unchanged. However, automated tools can paste dozens of images within a single second. With only three characters (46,656 combinations), the probability of a name collision would then reach a few percent, which is too high to ignore. The random part therefore keeps five characters.
  • The regular expression that detects pasted images in getInlineAttachmentMarkup (used to set the display width of the image) is updated to match the new format.

Files

Actions #1

Updated by Go MAEDA about 23 hours ago

  • Target version set to 7.1.0

Setting the target version to 7.1.0.

Actions

Also available in: Atom PDF