pmario / file-backups

File Save & Backup Utility For TiddlyWiki
https://pmario.github.io/file-backups
75 stars 7 forks source link

TW extension #21

Closed pinysuse closed 6 years ago

pinysuse commented 6 years ago

Issue

TW file named xxx.html: file-backups performs as expected TW file named xxx.hta: file-backups does not work, the "save file"/"download dialog bx appears

Configuration

TW Version 5.1.15 and 5.1.13 affected (probably not relevant) file-backups 0.3.5 FF 58.0.2 (64-Bit) FF config: Save downloads in ~/Downloads OS: Linux 4.4.114-42-default x86_64 openSUSE 42.3 (x86_64) Qt: 5.10.0 KDE: 5.43.0 Plasma: 5.12.3

Setup

twBackups created in a directory linked to ~/Downloads

Expected Behavior

Allow arbitrary extensions or issue a warning

Remark

I used the extension .hta from the early beginnings of using TW classic. Previous use of TW with file-backups worked with this extension. Unfortunately cannot provide info on previous use since several updates of FF (and probably file-backups) occurred since last use of one of my TWs.

pmario commented 6 years ago

.hta is a MS specific extension: https://en.wikipedia.org/wiki/HTML_Application It worked well with IE 5 to 9. With IE there is a possibility to natively save / overwrite an existing file. IE 10+ know about the file extension, but have limited possibilities.

I did a short test and it still saves with IE win10.

Since it still works with IE10+ and windows, I'll close the issue. ...

pmario commented 6 years ago

I used the extension .hta from the early beginnings of using TW classic. Previous use of TW with file-backups worked with this extension. Unfortunately cannot provide info on previous use since several updates of FF (and probably file-backups) occurred since last use of one of my TWs.

are you sure? My system even doesn't know about the extension.

pmario commented 6 years ago

ubuntu 17.10 can't handle the file type. .. so It opens the system save dialog. ...

pinysuse commented 6 years ago

Yes, I am sure about having used .hta ...however, I do not find any MIME-type definition on my system

Test:

Naming the TW5 file just "tttt" w/o extension:

file tttt tttt: HTML document, UTF-8 Unicode text, with very long lines, with CRLF, LF line terminators "double click" in dolphin opens FF correctly and save from within TW5 creates a file in "~/Downloads" (i.e. file-backup mechanism fails)

Naming the TW5 file arbitrily "tttt2.asdf"

file tttt2.asdf and "double click" in dolphin -> exactly same behaviour

Naming the TW5 file arbitrily "tttt3.pdf"

file tttt3.pdf tttt3.pdf: HTML document, UTF-8 Unicode text, with very long lines, with CRLF, LF line terminators "double click" in dolphin opens PDF viewer (okular) which complains about an Error

Theory:

  1. Unknown extensions are handled by file magic
  2. Registered file extensions (the shadow of DOS...) are opened acc. the MIME-type definition
  3. file-backups somehow requires extension .html

Note:

I think it is not really important which value this file extension has (anyway just a DOS thingy) - it would be good for the user to know that this applications needs ".html"

pmario commented 6 years ago

As I wrote. ... None of my FireFox browsers, windows and ubuntu, know about .hta files, as web pages. ..

They don't open them. I do get a dialog: "What should FF do?" ... Which is a OS dialog. ...

I did test .hta files with IE on windows 10 it saves. ... NO plugin needed. ... It is MS specific and also Edge browser doesn't open it. ...

So I wont-fix .hta specific problems. ...

pmario commented 6 years ago

At the moment the plugin uses 2 patterns to be enabled.

      "matches": [
        "file:///*.html",
        "file:///*.htm"
      ],

I'll check if it makes sense to extend those ... Not sure atm. ...

pmario commented 6 years ago

Web extensions have a manifest.json file, that is evaluated by browsers at addOn installation time. ... It is relatively strict, for security reasons. ...

One goal of the plugin was, to use as less permissions as possible. That's why it only uses 2 at the moment.

If I add arbitrary extension I'd need to use file:///*.* which would inject the plugin scripts into every page, that is loaded from the users drive.

Call me paranoid, but I personally don't want any plugin to have this behavior. ... except add-blockers.

I did update the addOn info page: https://addons.mozilla.org/en-US/firefox/addon/file-backups/

pinysuse commented 6 years ago

I am fully with you - just a little hint in the documentation might help others stumbling into this. Linux-Users might not be so used to beware correct filename extensions

In case you added this already on the info page - please apologize but I just checked and didn't notice.

pmario commented 6 years ago

In case you added this already on the info page - please apologize but I just checked and didn't notice.

No problem. Thx for your info! ... I did add it 1 day ago :)