mirror of
https://github.com/ChatGPTNextWeb/ChatGPT-Next-Web.git
synced 2025-05-20 04:30:17 +09:00
Merge c89fbf0e88
into 3809375694
This commit is contained in:
commit
ac5bb80d63
@ -456,8 +456,13 @@ export function ImagePreviewer(props: {
|
|||||||
|
|
||||||
if (isMobile || (isApp && window.__TAURI__)) {
|
if (isMobile || (isApp && window.__TAURI__)) {
|
||||||
if (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({
|
const result = await window.__TAURI__.dialog.save({
|
||||||
defaultPath: `${props.topic}.png`,
|
defaultPath: `${fileName}.png`,
|
||||||
filters: [
|
filters: [
|
||||||
{
|
{
|
||||||
name: "PNG Files",
|
name: "PNG Files",
|
||||||
|
12
app/utils.ts
12
app/utils.ts
@ -52,12 +52,18 @@ export async function copyToClipboard(text: string) {
|
|||||||
|
|
||||||
export async function downloadAs(text: string, filename: string) {
|
export async function downloadAs(text: string, filename: string) {
|
||||||
if (window.__TAURI__) {
|
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({
|
const result = await window.__TAURI__.dialog.save({
|
||||||
defaultPath: `${filename}`,
|
defaultPath: `${fileName}`,
|
||||||
filters: [
|
filters: [
|
||||||
{
|
{
|
||||||
name: `${filename.split(".").pop()} files`,
|
name: `${fileExtension} files`,
|
||||||
extensions: [`${filename.split(".").pop()}`],
|
extensions: [`${fileExtension}`],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "All Files",
|
name: "All Files",
|
||||||
|
Loading…
Reference in New Issue
Block a user