Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Attachments getting 404 #156

Open
kLy opened this issue Jul 25, 2022 · 10 comments
Open

Attachments getting 404 #156

kLy opened this issue Jul 25, 2022 · 10 comments

Comments

@kLy
Copy link

kLy commented Jul 25, 2022

When browsing, no images / attachments are visible, and when I click on them, I get a 404.

Going to:
http://localhost:5050/channel/art-style/attachments/F023TQ4DW5Q-image.png

Gives me:
INFO:werkzeug:127.0.0.1 - - [25/Jul/2022 13:24:46] "GET /channel/art-style/attachments/F023TQ4DW5Q-image.png HTTP/1.1" 404 -

However the attachments are present in the directory of the export:

> ls art-style/attachments/F023TQ4DW5Q-image.png
art-style/attachments/F023TQ4DW5Q-image.png

Is this a bug or just user error? The export has been generated using the slackdump tool. So trying to figure out if this is an issue with slack-export-viewer or slackdump.

Thanks!

@lucajovine
Copy link

lucajovine commented Aug 3, 2022

I also cannot see the attachments due to a 404 error. For example:

> slack-export-viewer -z test
Archive already extracted. Viewing from /Users/luca/test...
WARNING: This is a development server. Do not use it in a production deployment. Use a production WSGI server instead.
 * Serving Flask app 'slackviewer.app'
 * Debug mode: off
 * Running on http://localhost:5000 (Press CTRL+C to quit)
127.0.0.1 - - [03/Aug/2022 22:37:10] "GET / HTTP/1.1" 200 -
INFO:werkzeug:127.0.0.1 - - [03/Aug/2022 22:37:10] "GET / HTTP/1.1" 200 -
127.0.0.1 - - [03/Aug/2022 22:37:11] "GET /static/viewer.css HTTP/1.1" 304 -
INFO:werkzeug:127.0.0.1 - - [03/Aug/2022 22:37:11] "GET /static/viewer.css HTTP/1.1" 304 -
127.0.0.1 - - [03/Aug/2022 22:37:11] "GET /favicon.ico HTTP/1.1" 404 -
INFO:werkzeug:127.0.0.1 - - [03/Aug/2022 22:37:11] "GET /favicon.ico HTTP/1.1" 404 -
127.0.0.1 - - [03/Aug/2022 22:37:19] "GET /channel/eng_trrosetta_models/ HTTP/1.1" 200 -
INFO:werkzeug:127.0.0.1 - - [03/Aug/2022 22:37:19] "GET /channel/eng_trrosetta_models/ HTTP/1.1" 200 -
127.0.0.1 - - [03/Aug/2022 22:37:19] "GET /static/viewer.css HTTP/1.1" 304 -
INFO:werkzeug:127.0.0.1 - - [03/Aug/2022 22:37:19] "GET /static/viewer.css HTTP/1.1" 304 -
127.0.0.1 - - [03/Aug/2022 22:37:21] "GET /channel/eng_trrosetta_models/attachments/F024TLHB0DV-newplot.png HTTP/1.1" 404 -
INFO:werkzeug:127.0.0.1 - - [03/Aug/2022 22:37:21] "GET /channel/eng_trrosetta_models/attachments/F024TLHB0DV-newplot.png HTTP/1.1" 404 -

but the image file in question is there:

> ls -l /Users/luca/test/eng_trrosetta_models/attachments/F024TLHB0DV-newplot.png
-rw-r--r--  1 luca  staff  29329 Aug  3 22:32 /Users/luca/test/eng_trrosetta_models/attachments/F024TLHB0DV-newplot.png

@jowebb
Copy link

jowebb commented Aug 12, 2022

Same issue as kLy - I used the slackdump tool to get an export of DMs and attachments as well as public channels as Slack's export only does public channels on free tier. Had to unzip and recreate zip to resolve another issue but it worked fine other than not displaying images (or recognizing videos):

127.0.0.1 - - [11/Aug/2022 17:21:09] "GET /channels/general-chat/attachments/F020VQUPRFB-MHk.jpg HTTP/1.1" 404 -
INFO:werkzeug:127.0.0.1 - - [11/Aug/2022 17:21:09] "GET /channels/general-chat/attachments/F020VQUPRFB-MHk.jpg HTTP/1.1" 404

Image is definitely in general-chat/attachments

(slackdump puts all images from dms in top level attachments folder, but has an attachments folder under the dir for public channels such as the above).

@csaket
Copy link

csaket commented Aug 18, 2022

I have the same issue as well

@kLy
Copy link
Author

kLy commented Oct 11, 2022

Any update on this? Or anyone found any workarounds? Was this reproducible by the developer?

@ExploWare
Copy link

The slack export viewer was probably designed for official Slack exports, not slackdump-like.
therefor it is not able to reference local files. Flask (the internal webserver used here) is not based on local file systems and it's static content is pointed to a folder inside the slackviewer source, where viewer.css is served.
If you need it, you could place the file structure in there, but that would be a manual step.
I'm not so familiar with Flask, so I can only hope one will create a dynamic link to the content of the zip/folder exported by slackdump to get Flask to serve these static files.

@jlause
Copy link

jlause commented Nov 22, 2022

The slack export viewer was probably designed for official Slack exports, not slackdump-like. therefor it is not able to reference local files. Flask (the internal webserver used here) is not based on local file systems and it's static content is pointed to a folder inside the slackviewer source, where viewer.css is served. If you need it, you could place the file structure in there, but that would be a manual step. I'm not so familiar with Flask, so I can only hope one will create a dynamic link to the content of the zip/folder exported by slackdump to get Flask to serve these static files.

Hi @ExploWare ,

I have the same issue and would be interested to try the manual step you described..
So do I understand correctly that I would need to copy the slackdump directory to the slackviewer folder inside my python/anaconda folder? (e.g. in my particular case at /home/user/miniconda3/envs/myenv/lib/python3.10/site-packages/slackviewer/static ?
Will try that now..

@jlause
Copy link

jlause commented Nov 22, 2022

PS: Did not work first try - e.g. I have an image link in the slackviewer html

http://localhost:5000/channel/channelname/attachments/F03NMKELY03-image.png

and made a folder

/home/user/miniconda3/envs/myenv/lib/python3.10/site-packages/slackviewer/static/channel

into which I copied the exported channelname folder which contains the correct attachment at attachments/F03NMKELY03-image.png, but it still does not work - where exactly is the place where I should put my files? i.e. where is the place the Flask server looks for files?

@ExploWare
Copy link

ExploWare commented Nov 22, 2022

@jlause I've downloaded slack-export-viewer from git, so it is in my downloads folder, extracted the zip there, went into that folders slackviewer/static (I did it on windows, so something like %USER_PROFILE%\Downloads\slack-export-viewer-1.1.4\slackviewer\static)
I only exported one conversation, so into there I copied the conversation folder, and changed the .json file references to reflect accordingly.
original
"url_private": "attachments/F**********-Image from iOS.jpg",
"url_private_download": "attachments/F**********-Image from iOS.jpg",
"original_h": 3024,
"original_w": 4032,
"thumb_64": "https://files.slack.com/files-tmb/T**********-F**********-f*********/image_from_ios_64.jpg",
"thumb_80": "https://files.slack.com/files-tmb/T**********-F**********-f*********/image_from_ios_80.jpg",
now:
"url_private": "/static/D**********/attachments/F**********-Image from iOS.jpg",
"url_private_download": "/static/D**********/attachments/F**********-Image from iOS.jpg",
"original_h": 3024,
"original_w": 4032,
"thumb_64": "/static/D**********/attachments/F**********-Image from iOS.jpg",
"thumb_80": "/static/D**********/attachments/F**********-Image from iOS.jpg",
and so on (please note the capitalization of the filenames.)

Quite an easy replace, also for sed or some regex-capable notepad/texteditor

@kLy
Copy link
Author

kLy commented Nov 28, 2022

Great! I'll try that as a workaround.

At the root of it though, what should be fixed? Is it slack-export-viewer to handle the static local format? Or slack-exporter to make it output the right format?

@kLy
Copy link
Author

kLy commented Feb 27, 2023

Guess there's still no movement on this bug?

I actually tried the workaround above and it didn't work for me. If you look at the OP, the URLs there are actually correct and didn't need modifying. The problem is that the web server isn't displaying those images.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

7 participants