mirror of
				https://github.com/go-gitea/gitea.git
				synced 2025-10-31 02:46:04 +01:00 
			
		
		
		
	enforce maxlength in frontend (#29389)
Set maxlength attribute in frontend to long file-name   (same for branch-name and commit-summary)
This commit is contained in:
		
				
					committed by
					
						 GitHub
						GitHub
					
				
			
			
				
	
			
			
			
						parent
						
							d2f6588b66
						
					
				
				
					commit
					756b952c52
				
			| @@ -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 | ||||
|   | ||||
		Reference in New Issue
	
	Block a user