TiddlyWiki / TiddlyDesktop

A custom desktop browser for TiddlyWiki 5 and TiddlyWiki Classic, based on nw.js
1.63k stars 121 forks source link

Fix #214 Filter out invalid pathnames. #259

Closed Zacharia2 closed 1 year ago

Zacharia2 commented 1 year ago

Find pathnames with BadPathName feature and filter them out。

Jermolene commented 1 year ago

Hi @Zacharia2. Many thanks for your contribution, and welcome to the project.

The instructions for debugging TiddlyDesktop with VSCode are very helpful. I wasn't clear on the purpose of the bad filename feature. Is there a situation where that string occurs as a filename?

Jermolene commented 1 year ago

(I've edited the above post to remove a reference to the Contributor License Agreement, which we do not currently use with TiddlyDesktop).

Zacharia2 commented 1 year ago

Hi,@Jermolene . I observed that whenever issue #214 comes up, I can AppData\Local\TiddlyDesktop\User Data\Default\user-config-tiddlywiki\tiddlers directory to get two files. These two files are two tiddler filenames, and the filenames are the tiddler titles. because of the length limitation of the filenames only part of them are displayed, I traced the source of these bad titles and found that they come from two calls to the Windowlist.openbyPathName function in mian.js, one listening to the app launch place, and the other is a command variable that is passed to the boot function of tiddlywiki. They both call this openbyPathName function, and I can filter out the pathname parameter in the function. To achieve the effect of bug resolution.

I speculate that the bug is caused by passing the path of a program as the pathname parameter to the openbyPathName function when starting a program when there is already an instance.

And now, after filtering it out, all the problems with issue #214 are gone.

Zacharia2 commented 1 year ago

the bad filename feature. is used as part of the bad file name, and filtered out when the file name contains the bad filename feature.

const BadPathNameFeature = '--mixed-context --enable-spell-checking --allow-file-access-from-files';
$_TiddlyDesktop_Config_title_wikifile____D__Software_Z_Extended_TiddlyDesktop-win64-v0.0.15-prerelease.2_nw.exe --mixed-context --enable-spell-checking --allow-file-access-from-files --allow-file-ac.tid

wikifile____D__Software_Z_Extended_TiddlyDesktop-win64-v0.0.15-prerelease.2_nw.exe_ --mixed-context --enable-spell-checking --allow-file-access-from-files --allow-file-access --allow-file-cookies --di.tid
Jermolene commented 1 year ago

I'd like to merge the changes to the readme, and investigate the filename handling issue.

Zacharia2 commented 1 year ago

Thank you

Jermolene commented 1 year ago

Thanks @Zacharia2 – the readme update is in https://github.com/TiddlyWiki/TiddlyDesktop/commit/7721b99b8d838d9e30d836c6b506c5876da883e5 and I'm investigating the other issue now.