mirror of
https://github.com/go-gitea/gitea.git
synced 2026-08-02 14:29:43 +00:00
fix: correct full url when using sub-path (#38712)
fix #38708 --------- Co-authored-by: silverwind <me@silverwind.io> Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
import {
|
||||
dirname, basename, extname, formatBytes, isObject, stripTags, parseIssueHref,
|
||||
translateMonth, translateDay, blobToDataURI,
|
||||
toAbsoluteUrl, encodeURLEncodedBase64, decodeURLEncodedBase64, isImageFile, isVideoFile, parseRepoOwnerPathInfo,
|
||||
encodeURLEncodedBase64, decodeURLEncodedBase64, isImageFile, isVideoFile, parseRepoOwnerPathInfo,
|
||||
} from './utils.ts';
|
||||
|
||||
test('dirname', () => {
|
||||
@@ -88,16 +88,6 @@ test('blobToDataURI', async () => {
|
||||
expect(await blobToDataURI(blob)).toEqual('data:application/json;base64,eyJ0ZXN0Ijp0cnVlfQ==');
|
||||
});
|
||||
|
||||
test('toAbsoluteUrl', () => {
|
||||
expect(toAbsoluteUrl('//host/dir')).toEqual('http://host/dir');
|
||||
expect(toAbsoluteUrl('https://host/dir')).toEqual('https://host/dir');
|
||||
|
||||
expect(toAbsoluteUrl('')).toEqual('http://localhost:3000');
|
||||
expect(toAbsoluteUrl('/user/repo')).toEqual('http://localhost:3000/user/repo');
|
||||
|
||||
expect(() => toAbsoluteUrl('path')).toThrow('unsupported');
|
||||
});
|
||||
|
||||
test('encodeURLEncodedBase64, decodeURLEncodedBase64', () => {
|
||||
const encoder = new TextEncoder();
|
||||
const uint8array = encoder.encode.bind(encoder);
|
||||
|
||||
Reference in New Issue
Block a user