Skip to content
Snippets Groups Projects
Commit 62de18c4 authored by vaartis's avatar vaartis
Browse files

Add baseName to some remote instance requests

parent 9376da91
No related branches found
No related tags found
No related merge requests found
Pipeline #17569 passed
......@@ -54,7 +54,7 @@ export async function listRemotePacks(host, token, instance) {
url: `/api/pleroma/emoji/packs/list_from`,
method: 'post',
headers: authHeaders(token),
data: { instance_address: instance }
data: { instance_address: baseName(instance) }
})
}
......@@ -68,7 +68,7 @@ export async function downloadFrom(host, instance_address, pack_name, as, token)
url: '/api/pleroma/emoji/packs/download_from',
method: 'post',
headers: authHeaders(token),
data: { instance_address, pack_name, as },
data: { instance_address: baseName(instance_address), pack_name, as },
timeout: 0
})
}
......
......@@ -2,7 +2,7 @@ const isLocalhost = (instanceName) =>
instanceName.startsWith('localhost:') || instanceName.startsWith('127.0.0.1:')
export const baseName = (instanceName) => {
if (instanceName.match(/^http?:\/\//)) {
if (instanceName.match(/https?:\/\//)) {
return instanceName
} else {
return isLocalhost(instanceName) ? `http://${instanceName}` : `https://${instanceName}`
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment