Feature #44642 » 0002-Include-seconds-in-pasted-image-filenames.patch
| app/assets/javascripts/attachments.js | ||
|---|---|---|
| 277 | 277 |
const inlineFilename = encodeURIComponent(sanitizedFilename) |
| 278 | 278 |
.replace(/[!()]/g, function(match) { return "%" + match.charCodeAt(0).toString(16) });
|
| 279 | 279 | |
| 280 |
const isFromClipboard = /^clipboard-\d{12}-[a-z0-9]{5}\.\w+$/.test(file.name);
|
|
| 280 |
const isFromClipboard = /^clipboard-\d{14}-[a-z0-9]{5}\.\w+$/.test(file.name);
|
|
| 281 | 281 |
let imageDisplayWidth; |
| 282 | 282 |
if (isFromClipboard) {
|
| 283 | 283 |
const imageWidth = await getImageWidth(file).catch(() => 0); |
| ... | ... | |
| 353 | 353 |
+ ('0'+date.getDate()).slice(-2)
|
| 354 | 354 |
+ ('0'+date.getHours()).slice(-2)
|
| 355 | 355 |
+ ('0'+date.getMinutes()).slice(-2)
|
| 356 |
+ ('0'+date.getSeconds()).slice(-2)
|
|
| 356 | 357 |
+ '-' + randomKey(5).toLocaleLowerCase() |
| 357 | 358 |
+ '.' + file.name.split('.').pop();
|
| 358 | 359 | |
| test/system/issues_test.rb | ||
|---|---|---|
| 206 | 206 |
document.getElementById('issue_description').dispatchEvent(event);
|
| 207 | 207 |
JS |
| 208 | 208 |
filename = find('.attachments_fields input.filename').value
|
| 209 |
assert_match /\Aclipboard-\d{12}-[a-z0-9]{5}\.png\z/, filename
|
|
| 209 |
assert_match /\Aclipboard-\d{14}-[a-z0-9]{5}\.png\z/, filename
|
|
| 210 | 210 |
assert_field 'issue_description', :with => %(<img style="width: 1px;" src="#{filename}"><br>\n)
|
| 211 | 211 |
end |
| 212 | 212 | |
- « Previous
- 1
- 2
- 3
- Next »