Compare commits

...

3 Commits

Author SHA1 Message Date
H0llyW00dzZ
12a4fd0286
Merge c89fbf0e88 into 557a2cce35 2025-08-04 10:40:23 +00:00
DeanYao
c89fbf0e88
Merge branch 'main' into tauridialog 2024-03-28 16:01:46 +08:00
H0llyW00dzZ
2835901a64
Fix Client App [Tauri]
[+] fix(exporter.tsx): fix issue with saving files in client app [Tauri] when there is a ':' in the dialog
[+] fix(utils.ts): fix issue with saving files in client app [Tauri]  when there is a ':' in the dialog
2023-10-20 04:43:47 +07:00
2 changed files with 15 additions and 4 deletions

View File

@ -456,8 +456,13 @@ export function ImagePreviewer(props: {
if (isMobile || (isApp && window.__TAURI__)) {
if (isApp && window.__TAURI__) {
/**
* Fixed client app [Tauri]
* Resolved the issue where files couldn't be saved when there was a `:` in the dialog.
*/
const fileName = props.topic.replace(/:/g, '');
const result = await window.__TAURI__.dialog.save({
defaultPath: `${props.topic}.png`,
defaultPath: `${fileName}.png`,
filters: [
{
name: "PNG Files",

View File

@ -52,12 +52,18 @@ export async function copyToClipboard(text: string) {
export async function downloadAs(text: string, filename: string) {
if (window.__TAURI__) {
/**
* Fixed client app [Tauri]
* Resolved the issue where files couldn't be saved when there was a `:` in the dialog.
**/
const fileName = filename.replace(/:/g, '');
const fileExtension = fileName.split('.').pop();
const result = await window.__TAURI__.dialog.save({
defaultPath: `${filename}`,
defaultPath: `${fileName}`,
filters: [
{
name: `${filename.split(".").pop()} files`,
extensions: [`${filename.split(".").pop()}`],
name: `${fileExtension} files`,
extensions: [`${fileExtension}`],
},
{
name: "All Files",