yuya373 / emacs-slack

slack client for emacs
1.11k stars 117 forks source link

Images not rendering #558

Open jsilve24 opened 2 years ago

jsilve24 commented 2 years ago

Describe the bug I am seeing the exact same bug as described in the now closed issue #495.

I have cleared the cache in slack-image-file-directory, completely removed and rebuilt emacs-slack and dependencies but I am getting this regardless of what I do. Its been like this since I first setup emacs-slack about 3 days ago.

Everything else is working fine. I can see profile pictures just not these images or any other attached images.

slack-image-not-displaying

Note, I also cannot display the iage if I I click on the file name (e.g., deseq2_vs_ols_clr.png), that is the imge just shows up as a square outline in the slack-file-info buffer. However, if I click on "Actions" -> "Open Original" it opens fine in my browser.

To Reproduce Steps to reproduce the behavior: for me, install slack, try to view any uploaded image.

Backtrace none

Expected behavior images displayed

Screenshots (see above)

Environment:

EDIT: Looking more into this, the image has the following display property:

((slice 0 0.80008 1.0 0.20002) (image :type png :file "/tmp/bb8f4a6cd49990fc00b8eeb42cf4b8e0.png" :scale 1 :height 360 :width 225 :max-height 360 :max-width 360))

Sure enough, that image is just an empty square (e.g., its like the image was not downloaded correctly), though the image clearly exists on the server. Note the image also displays fine in slack desktop.

Also, I am not sure if it helps but trying to run 'slack-file-update' in this buffer gets the following backtrace:

Debugger entered--Lisp error: (invalid-slot-name "#<slack-message-buffer slack-message-buffer-155a72737b10>" file)
  signal(invalid-slot-name ("#<slack-message-buffer slack-message-buffer-155a72..." file))
  slot-missing(#<slack-message-buffer slack-message-buffer-155a72737b10> file oref)
  eieio-oref(#<slack-message-buffer slack-message-buffer-155a72737b10> file)
  slack-file-update()
  funcall-interactively(slack-file-update)
  call-interactively(slack-file-update record nil)
  command-execute(slack-file-update record)
  execute-extended-command(nil "slack-file-update" nil)
  funcall-interactively(execute-extended-command nil "slack-file-update" nil)
  call-interactively(execute-extended-command nil nil)
  command-execute(execute-extended-command)

EDIT:

I noticed the following messages when I try to view a message that has an image:

Not a PNG file: ‘/tmp/bb8f4a6cd49990fc00b8eeb42cf4b8e0.png’ [5 times]
Not a PNG file: ‘/tmp/29e9fecaa58068c83ca0f54865dfd95d.png’ [4 times]
Not a PNG file: ‘/tmp/ff4577ed4426c2a61827b05978363fc8.png’ [3 times]
Not a PNG file: ‘/tmp/bb8f4a6cd49990fc00b8eeb42cf4b8e0.png’ [5 times]
Not a PNG file: ‘/tmp/29e9fecaa58068c83ca0f54865dfd95d.png’ [4 times]
isamert commented 2 years ago

Hey @jsilve24, are you using emacs-slack with xoxc token? If that's the case, emacs-slack does not support file downloads with it. Can you try my fix on #559 and check if it works for you?

jsilve24 commented 2 years ago

Hi @isamert. Yes I do have an xoxc token but the fix doesn't seem to work. I have tried a few things:

  1. my straight recipe is: :straight (:type git :host github :repo "isamert/emacs-slack")
  2. I have ensured that the code reflected in the newest commit is loaded by emacs (e.g., C-h f shows function source with latest commited changes)
  3. I rm -rf'd everything in slack-image-file-directory
  4. I restarted emacs multiple times to see if there was some magit missing.

Still seeing the same thing: images not downloaded.

jsilve24 commented 2 years ago

Also when I force manual download of images, via the corresponding slack-file-info buffer, I just see an empty square where an image should be. (same as what I am seeing in the message buffer).

isamert commented 2 years ago

@jsilve24 Can you try the fix-curl-downloader branch in my repo? master branch has some other stuff that is specific to my workflow and the changes for the image fix is not merged to my master.

I guess you have to provide :branch "fix-curl-downloader" to :straight option.

jsilve24 commented 2 years ago

It works!!!

Thank you!

isamert commented 2 years ago

Great! Also thanks for testing it.