mirror of
https://github.com/marktext/marktext.git
synced 2025-05-02 23:12:45 +08:00
fix: feature request 2106 (Always use forward slashes on Windows) (#2824)
This commit is contained in:
parent
db1d2b7aef
commit
93da27118d
@ -6,7 +6,7 @@ import dayjs from 'dayjs'
|
||||
import Octokit from '@octokit/rest'
|
||||
import { ensureDirSync } from 'common/filesystem'
|
||||
import { isImageFile } from 'common/filesystem/paths'
|
||||
import { dataURItoBlob } from './index'
|
||||
import { isWindows, dataURItoBlob } from './index'
|
||||
import axios from '../axios'
|
||||
|
||||
export const create = (pathname, type) => {
|
||||
@ -51,6 +51,11 @@ export const moveToRelativeFolder = async (cwd, imagePath, relativeName) => {
|
||||
|
||||
// dstRelPath: relative directory name + image file name
|
||||
const dstRelPath = path.join(relativeName, path.basename(imagePath))
|
||||
|
||||
if (isWindows) {
|
||||
// Use forward slashes for better compatibility with websites.
|
||||
return dstRelPath.replace(/\\/g, '/')
|
||||
}
|
||||
return dstRelPath
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user