mirror of
				https://github.com/go-gitea/gitea.git
				synced 2025-10-26 12:27:06 +00:00 
			
		
		
		
	Use fetch helpers instead of fetch (#27026)
WIP because: - [x] Some calls set a `content-type` but send no body, can likely remove the header - [x] Need to check whether `charset=utf-8` has any significance on the webauthn calls, I assume not as it is the default for json content. - [x] Maybe `no-restricted-globals` is better for eslint, but will require a lot of duplication in the yaml or moving eslint config to a `.js` extension. - [x] Maybe export `request` as `fetch`, shadowing the global.
This commit is contained in:
		| @@ -1,6 +1,7 @@ | ||||
| import {clippie} from 'clippie'; | ||||
| import {showTemporaryTooltip} from '../modules/tippy.js'; | ||||
| import {convertImage} from '../utils.js'; | ||||
| import {GET} from '../modules/fetch.js'; | ||||
|  | ||||
| const {i18n} = window.config; | ||||
|  | ||||
| @@ -20,7 +21,7 @@ export function initCopyContent() { | ||||
|     if (link) { | ||||
|       btn.classList.add('is-loading', 'small-loading-icon'); | ||||
|       try { | ||||
|         const res = await fetch(link, {credentials: 'include', redirect: 'follow'}); | ||||
|         const res = await GET(link, {credentials: 'include', redirect: 'follow'}); | ||||
|         const contentType = res.headers.get('content-type'); | ||||
|  | ||||
|         if (contentType.startsWith('image/') && !contentType.startsWith('image/svg')) { | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 silverwind
					silverwind