citizenos / ep_image_upload

Add images to etherpad and upload them to Amazon S3
Other
9 stars 16 forks source link

Show other file types as download link #5

Open rasos opened 4 years ago

rasos commented 4 years ago

Other file types than images are not shown as download link.

Bildschirmfoto_dateien_falsch

As the sister plugin ep_fileupload has an unresolved cross origin issue https://github.com/redhog/ep_fileupload/issues/24 and is un-usable, it would be nice to extend the functionality by showing a download link for non-image MIME types.
"fileTypes": ["jpeg","jpg","bmp","gif","png","pdf","mp4","ogg","mp3","webm","wav","md","rtf","tex","txt","doc","docx","xls","xlsx","pptx","ods","odt","odp","html","pages","py","zip"],

JohnMcLear commented 3 years ago

I'm not sure I understand this issue @rasos ;/

rasos commented 3 years ago

The idea was that this plugin also allows other file types to be uploaded, such as a PDF to be shared.

If I add pdf as file type, we get an exception when uploading a pdf:

[2021-02-14 10:36:36.097] [ERROR] console - TypeError [ERR_INVALID_URL]: Invalid URL: testboard3/347a01bb-1931-49fd-8c06-2545ebc5f27c.pdf
    at new NodeError (node:internal/errors:329:5)
    at onParseError (node:internal/url:282:9)
    at new URL (node:internal/url:358:5)
    at new URL (node:internal/url:355:22)
    at Busboy.<anonymous> (/opt/etherpad-lite/node_modules/ep_image_upload/index.js:132:24)
    at Busboy.emit (node:events:378:20)
    at Busboy.EventEmitter.emit (node:domain:470:12)
    at Busboy.emit (/opt/etherpad-lite/node_modules/busboy/lib/main.js:38:33)
    at PartStream.<anonymous> (/opt/etherpad-lite/node_modules/busboy/lib/types/multipart.js:213:13)
    at PartStream.emit (node:events:378:20)
    at PartStream.EventEmitter.emit (node:domain:470:12)
    at HeaderParser.<anonymous> (/opt/etherpad-lite/node_modules/dicer/lib/Dicer.js:51:16)
    at HeaderParser.emit (node:events:378:20)
    at HeaderParser.EventEmitter.emit (node:domain:470:12)
    at HeaderParser._finish (/opt/etherpad-lite/node_modules/dicer/lib/HeaderParser.js:68:8)
    at SBMH.<anonymous> (/opt/etherpad-lite/node_modules/dicer/lib/HeaderParser.js:40:12)

I understand that for each media type (audio, video) an extra plugin is required. There is none for documents yet (PDF, docx, xlsx etc).

JohnMcLear commented 3 years ago

Oh that wasn't within scope with plugin description as I read it. My apologies if I missed that..

I won't get chance for a few months to look at this but the code is not very readable and maintainable so it should be relatively simple for a developer to add this functionality.

TheDarkTron commented 3 years ago

Comment from so completely unrelated: I doubt that the ep_image_upload plugin is the right place for this.