Fix instance url

Why do I need to keep doing this
This commit is contained in:
Lim Chee Aun 2023-04-19 10:42:26 +08:00
parent 3a4a75793a
commit dcb24382fc

View file

@ -523,6 +523,14 @@ function ShortcutForm({
const result = {};
data.forEach((value, key) => {
result[key] = value?.trim();
if (key === 'instance') {
// Remove protocol and trailing slash
result[key] = result[key]
.replace(/^https?:\/\//, '')
.replace(/\/+$/, '');
// Remove @acct@ or acct@ from instance URL
result[key] = result[key].replace(/^@?[^@]+@/, '');
}
});
console.log('result', result);
if (!result.type) return;