mirror of
https://github.com/Qortal/Qortal-Hub.git
synced 2025-06-01 14:16:58 +00:00
fix filename
This commit is contained in:
parent
8c2b635afb
commit
dd1c4c1999
@ -1921,8 +1921,9 @@ export const joinGroup = async (data, isFromExtension) => {
|
|||||||
|
|
||||||
export const saveFile = async (data, sender, isFromExtension, snackMethods) => {
|
export const saveFile = async (data, sender, isFromExtension, snackMethods) => {
|
||||||
try {
|
try {
|
||||||
|
if (!data?.filename) throw new Error('Missing filename');
|
||||||
if (data?.location) {
|
if (data?.location) {
|
||||||
const requiredFieldsLocation = ['service', 'name', 'filename'];
|
const requiredFieldsLocation = ['service', 'name'];
|
||||||
const missingFieldsLocation: string[] = [];
|
const missingFieldsLocation: string[] = [];
|
||||||
requiredFieldsLocation.forEach((field) => {
|
requiredFieldsLocation.forEach((field) => {
|
||||||
if (!data?.location[field]) {
|
if (!data?.location[field]) {
|
||||||
@ -1937,7 +1938,7 @@ export const saveFile = async (data, sender, isFromExtension, snackMethods) => {
|
|||||||
const resPermission = await getUserPermission(
|
const resPermission = await getUserPermission(
|
||||||
{
|
{
|
||||||
text1: 'Would you like to download:',
|
text1: 'Would you like to download:',
|
||||||
highlightedText: `${data?.location?.filename}`,
|
highlightedText: `${data?.filename}`,
|
||||||
},
|
},
|
||||||
isFromExtension
|
isFromExtension
|
||||||
);
|
);
|
||||||
@ -1949,11 +1950,10 @@ export const saveFile = async (data, sender, isFromExtension, snackMethods) => {
|
|||||||
locationUrl = locationUrl + `/${data.location.identifier}`;
|
locationUrl = locationUrl + `/${data.location.identifier}`;
|
||||||
}
|
}
|
||||||
const endpoint = await createEndpoint(
|
const endpoint = await createEndpoint(
|
||||||
locationUrl +
|
locationUrl + `?attachment=true&attachmentFilename=${data?.filename}`
|
||||||
`?attachment=true&attachmentFilename=${data?.location?.filename}`
|
|
||||||
);
|
);
|
||||||
a.href = endpoint;
|
a.href = endpoint;
|
||||||
a.download = data.location.filename;
|
a.download = data.filename;
|
||||||
document.body.appendChild(a);
|
document.body.appendChild(a);
|
||||||
a.click();
|
a.click();
|
||||||
a.remove();
|
a.remove();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user