mirror of
				https://github.com/go-gitea/gitea.git
				synced 2025-10-30 18:36:22 +01:00 
			
		
		
		
	Fix links for the menus in the view file page (#22795)
This commit is contained in:
		| @@ -134,9 +134,15 @@ export function convertImage(blob, mime) { | ||||
|   }); | ||||
| } | ||||
|  | ||||
| export function toAbsoluteUrl(relUrl) { | ||||
|   if (relUrl.startsWith('http://') || relUrl.startsWith('https://')) { | ||||
|     return relUrl; | ||||
| export function toAbsoluteUrl(url) { | ||||
|   if (url.startsWith('http://') || url.startsWith('https://')) { | ||||
|     return url; | ||||
|   } | ||||
|   return `${window.location.origin}${relUrl}`; | ||||
|   if (url.startsWith('//')) { | ||||
|     return `${window.location.protocol}${url}`; // it's also a somewhat absolute URL (with the current scheme) | ||||
|   } | ||||
|   if (url && !url.startsWith('/')) { | ||||
|     throw new Error('unsupported url, it should either start with / or http(s)://'); | ||||
|   } | ||||
|   return `${window.location.origin}${url}`; | ||||
| } | ||||
|   | ||||
		Reference in New Issue
	
	Block a user