diff --git a/src/components/pages/settings/parts/SettingsGenerators/GeneratorButton.tsx b/src/components/pages/settings/parts/SettingsGenerators/GeneratorButton.tsx
index 6043f789..46cec2d4 100755
--- a/src/components/pages/settings/parts/SettingsGenerators/GeneratorButton.tsx
+++ b/src/components/pages/settings/parts/SettingsGenerators/GeneratorButton.tsx
@@ -45,7 +45,6 @@ export type GeneratorOptions = {
};
export const copier = (options: GeneratorOptions) => {
- if (options.unix_useEcho) return 'echo';
if (options.mac_enableCompatibility) return 'pbcopy';
if (options.wl_enableCompatibility) return 'wl-copy';
return 'xclip -selection clipboard';
diff --git a/src/components/pages/settings/parts/SettingsGenerators/generators/shell.tsx b/src/components/pages/settings/parts/SettingsGenerators/generators/shell.tsx
index a931dfc2..3f617d4c 100755
--- a/src/components/pages/settings/parts/SettingsGenerators/generators/shell.tsx
+++ b/src/components/pages/settings/parts/SettingsGenerators/generators/shell.tsx
@@ -10,7 +10,7 @@ export function shell(token: string, type: 'file' | 'url', options: GeneratorOpt
];
if (type === 'file') {
- curl.push('-F', 'file=@$1');
+ curl.push('-F', '"file=@$1;type=$(file --mime-type -b "$1")"');
curl.push('-H', "'content-type: multipart/form-data'");
} else {
curl.push('-H', "'content-type: application/json'");
@@ -61,20 +61,22 @@ export function shell(token: string, type: 'file' | 'url', options: GeneratorOpt
}
for (const [key, value] of Object.entries(toAddHeaders)) {
- curl.push('-H', `${key}: ${value}`);
+ curl.push('-H', `"${key}: ${value}"`);
}
let script;
if (type === 'file') {
script = `#!/bin/bash
-${curl.join(' ')}${options.noJson ? '' : ' | jq -r .files[0].url'} | tr -d '\\n' | ${copier(options)}
+${curl.join(' ')}${options.noJson ? '' : ' | jq -r .files[0].url'}${
+ options.unix_useEcho ? '' : ` | ${copier(options)}`
+ }
`;
} else {
script = `#!/bin/bash
-${curl.join(' ')} -d "{\\"url\\": \\"$1\\"}"${
- options.noJson ? '' : ' | jq -r .files[0].url'
- } | tr -d '\\n' | ${copier(options)}
+${curl.join(' ')} -d "{\\"destination\\": \\"$1\\"}"${
+ options.noJson ? '' : ' | jq -r .url'
+ }${options.unix_useEcho ? '' : ` | ${copier(options)}`}
`;
}
diff --git a/src/components/pages/settings/parts/SettingsGenerators/index.tsx b/src/components/pages/settings/parts/SettingsGenerators/index.tsx
index b96191fe..fff1f308 100755
--- a/src/components/pages/settings/parts/SettingsGenerators/index.tsx
+++ b/src/components/pages/settings/parts/SettingsGenerators/index.tsx
@@ -79,6 +79,10 @@ export default function SettingsGenerators() {
curl
,{' '}
+
+ file
+
+ ,{' '}
jq