yuya373 / emacs-slack

slack client for emacs
1.11k stars 117 forks source link

barfs on files you don't have access to #572

Open unhammer opened 2 years ago

unhammer commented 2 years ago

Describe the bug Files like image create errors because they have no permalink nor title.

To Reproduce Steps to reproduce the behavior:

  1. Someone else tries to share a file which is (later?) marked private
  2. Try to open the conversation in which that happened (slack-select-room)
  3. See error

Backtrace

  propertize(nil file "F00BAR" face (:underline t :weight bold) keymap (keymap (mouse-1 . slack-file-display) (13 . slack-file-display)))
  slack-file-link-info("F00BAR" nil)
  (format "uploaded this %s: %s <%s|open in browser>" type (slack-file-link-info (eieio-oref file 'id) (slack-unescape title team)) (slot-value object 'permalink))
  (let ((type (slack-file-type file)) (title (slack-file-title file))) (format "uploaded this %s: %s <%s|open in browser>" type (slack-file-link-info (eieio-oref file 'id) (slack-unescape title team)) (slot-value object 'permalink)))
  (if (slack-file-deleted-p file) "This file was deleted." (let ((type (slack-file-type file)) (title (slack-file-title file))) (format "uploaded this %s: %s <%s|open in browser>" type (slack-file-link-info (eieio-oref file 'id) (slack-unescape title team)) (slot-value object 'permalink))))
  (let* ((object file)) (if (slack-file-deleted-p file) "This file was deleted." (let ((type (slack-file-type file)) (title (slack-file-title file))) (format "uploaded this %s: %s <%s|open in browser>" type (slack-file-link-info (eieio-oref file 'id) (slack-unescape title team)) (slot-value object 'permalink)))))
  (progn (let* ((object file)) (if (slack-file-deleted-p file) "This file was deleted." (let ((type (slack-file-type file)) (title (slack-file-title file))) (format "uploaded this %s: %s <%s|open in browser>" type (slack-file-link-info (eieio-oref file 'id) (slack-unescape title team)) (slot-value object 'permalink))))))
  (closure (t) (file _ts team) (progn (let* ((object file)) (if (slack-file-deleted-p file) "This file was deleted." (let ((type ...) (title ...)) (format "uploaded this %s: %s <%s|open in browser>" type (slack-file-link-info ... ...) (slot-value object ...)))))))(#<slack-file slack-file-123> "123.123" #<slack-team slack-team-123bc5a90>)
  apply((closure (t) (file _ts team) (progn (let* ((object file)) (if (slack-file-deleted-p file) "This file was deleted." (let ((type ...) (title ...)) (format "uploaded this %s: %s <%s|open in browser>" type (slack-file-link-info ... ...) (slot-value object ...))))))) #<slack-file slack-file-123> ("123.123" #<slack-team slack-team-123bc5a90>))
  slack-file-summary(#<slack-file slack-file-123> "123.123" #<slack-team slack-team-123bc5a90>)

Expected behavior Open conversation as usual

Screenshots

how it looks on web:

image

Environment:

unhammer commented 2 years ago

Workaround:


(cl-defmethod slack-file-summary ((file slack-file) _ts team)
  (if (slot-boundp file 'permalink)
      (with-slots (mode permalink) file
        (if (slack-file-deleted-p file)
            "This file was deleted."
          (let ((type (slack-file-type file))
                (title (slack-file-title file)))
            (format "uploaded this %s: %s <%s|open in browser>"
                    type
                    (slack-file-link-info (oref file id)
                                          (slack-unescape title team))
                    permalink))))
    (message "No permalink: %S" file)))