wp-epub-gen 0.1.0 → 0.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -31,6 +31,12 @@ const downloadImage = (epubData, options) => __awaiter(void 0, void 0, void 0, f
31
31
  let filename = path.join(image_dir, options.id + '.' + options.extension);
32
32
  if (url.startsWith('file://') || url.startsWith('/')) {
33
33
  let auxPath = url.replace(/^file:\/\//i, '');
34
+ if (process.platform === 'win32') {
35
+ // Windows 下,把 /C:/ 转换成 C:/ 这样的形式
36
+ if (auxPath.match(/^\/[a-zA-Z]:/)) {
37
+ auxPath = auxPath.replace(/^\//, '');
38
+ }
39
+ }
34
40
  log(`[Copy 1] '${auxPath}' to '${filename}'`);
35
41
  if (fs.existsSync(auxPath)) {
36
42
  try {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "wp-epub-gen",
3
- "version": "0.1.0",
3
+ "version": "0.1.1",
4
4
  "description": "Epub generator.",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -25,6 +25,14 @@ const downloadImage = async (epubData: IEpubData, options: IEpubImage): Promise<
25
25
  let filename = path.join(image_dir, options.id + '.' + options.extension)
26
26
  if (url.startsWith('file://') || url.startsWith('/')) {
27
27
  let auxPath = url.replace(/^file:\/\//i, '')
28
+
29
+ if (process.platform === 'win32') {
30
+ // Windows 下,把 /C:/ 转换成 C:/ 这样的形式
31
+ if (auxPath.match(/^\/[a-zA-Z]:/)) {
32
+ auxPath = auxPath.replace(/^\//, '')
33
+ }
34
+ }
35
+
28
36
  log(`[Copy 1] '${auxPath}' to '${filename}'`)
29
37
  if (fs.existsSync(auxPath)) {
30
38
  try {