GetPublii / Publii

The most intuitive Static Site CMS designed for SEO-optimized and privacy-focused websites.
https://getpublii.com
GNU General Public License v3.0
6.35k stars 420 forks source link

[Bug]: TypeError: item.replace is not a function #1303

Closed delirehberi closed 11 months ago

delirehberi commented 11 months ago

Operating system

macOS Sonoma 14

Publii version

0.44.1 (build 16519)

Post editor

None

Bug description

I am trying to import 1700 post from wordpress to publii. Everytime it stucks in a spesific post. Attached import-error.log file. I believe there is corrupted tag in there. It will be resolved after updating that line like this:

tagsToSave = tagsToSave.filter(function (item) {
                if(typeof item != 'string') return false;
                return item.replace(/\s/g, '') !== '';
            });

Steps to reproduce

No response

Relevant log output

/Applications/Publii.app/Contents/Resources/app.asar/back-end/post.js:462
                return item.replace(/\s/g, '') !== '';
                            ^

TypeError: item.replace is not a function
    at /Applications/Publii.app/Contents/Resources/app.asar/back-end/post.js:462:29
    at Array.filter (<anonymous>)
    at Post.saveTags (/Applications/Publii.app/Contents/Resources/app.asar/back-end/post.js:461:37)
    at Post.save (/Applications/Publii.app/Contents/Resources/app.asar/back-end/post.js:249:14)
    at WxrParser.importPostsData (/Applications/Publii.app/Contents/Resources/app.asar/back-end/modules/import/wxr-parser.js:432:41)
    at Import.importFile (/Applications/Publii.app/Contents/Resources/app.asar/back-end/modules/import/import.js:93:21)
    at process.<anonymous> (/Applications/Publii.app/Contents/Resources/app.asar/back-end/workers/import/import.js:14:18)
    at process.emit (node:events:513:28)
    at emit (node:internal/child_process:937:14)
    at process.processTicksAndRejections (node:internal/process/task_queues:83:21)

Node.js v18.16.1
dziudek commented 11 months ago

Hi,

Thank you for spotting this - fix will be added in v.0.44.2