enforce maxlength in frontend (#29389)

Set maxlength attribute in frontend

to long file-name

![image](15111614-55ab-4583-acb2-15c25997601d)

![image](4105ddd8-4973-4da8-b3ab-4cfae1b45554)
(same for branch-name and commit-summary)

(cherry picked from commit 756b952c52f1efbb137df36d5b97b370c8a45565)
This commit is contained in:
Tim-Niclas Oelschläger 2024-02-25 15:31:15 +01:00 committed by Earl Warren
parent 70f3c32b91
commit 4662f4feac
No known key found for this signature in database
GPG key ID: 0579CB2928A78A00
5 changed files with 9 additions and 8 deletions

View file

@ -2,13 +2,14 @@ import {encode, decode} from 'uint8-to-base64';
// transform /path/to/file.ext to file.ext
export function basename(path = '') {
return path ? path.replace(/^.*\//, '') : '';
const lastSlashIndex = path.lastIndexOf('/');
return lastSlashIndex < 0 ? path : path.substring(lastSlashIndex + 1);
}
// transform /path/to/file.ext to .ext
export function extname(path = '') {
const [_, ext] = /.+(\.[^.]+)$/.exec(path) || [];
return ext || '';
const lastPointIndex = path.lastIndexOf('.');
return lastPointIndex < 0 ? '' : path.substring(lastPointIndex);
}
// test whether a variable is an object