do not attempt to encode >1M sized articles #20

Merged
dickmao merged 2 commits from dev into master 2020-03-01 19:30:27 +00:00
3 changed files with 9 additions and 3 deletions

View File

@ -30,7 +30,6 @@ Then
:: ::
M-x package-refresh-contents RET M-x package-refresh-contents RET
M-x package-initialize RET
M-x package-install RET nnhackernews RET M-x package-install RET nnhackernews RET
Alternatively, copy ``nnhackernews.el`` to a directory among ``C-h v RET load-path`` and add ``(require 'nnhackernews)`` to ``.emacs``. Alternatively, copy ``nnhackernews.el`` to a directory among ``C-h v RET load-path`` and add ``(require 'nnhackernews)`` to ``.emacs``.

View File

@ -30,7 +30,6 @@ Then
:: ::
M-x package-refresh-contents RET M-x package-refresh-contents RET
M-x package-initialize RET
M-x package-install RET nnhackernews RET M-x package-install RET nnhackernews RET
Alternatively, copy ``nnhackernews.el`` to a directory among ``C-h v RET load-path`` and add ``(require 'nnhackernews)`` to ``.emacs``. Alternatively, copy ``nnhackernews.el`` to a directory among ``C-h v RET load-path`` and add ``(require 'nnhackernews)`` to ``.emacs``.

View File

@ -81,6 +81,11 @@ Do not set this to \"localhost\" as a numeric IP is required for the oauth hands
:type 'integer :type 'integer
:group 'nnhackernews) :group 'nnhackernews)
(defcustom nnhackernews-max-render-bytes 300e3
"`quoted-printable-encode-region' bogs when the javascript spyware gets out of hand."
:type 'integer
:group 'nnhackernews)
(defvoo nnhackernews-status-string "") (defvoo nnhackernews-status-string "")
(defvar nnhackernews--mutex-display-article (when (fboundp 'make-mutex) (defvar nnhackernews--mutex-display-article (when (fboundp 'make-mutex)
@ -1172,13 +1177,16 @@ Optionally provide STATIC-MAX-ITEM and STATIC-NEWSTORIES to prevent querying out
"nnhackernews-request-article" it "nnhackernews-request-article" it
:success (cl-function :success (cl-function
(lambda (&key data &allow-other-keys) (lambda (&key data &allow-other-keys)
(insert data)))) (if (> (length data) nnhackernews-max-render-bytes)
(insert body)
(insert data)))))
(error (gnus-message 5 "nnhackernews-request-article: %s" (error (gnus-message 5 "nnhackernews-request-article: %s"
(error-message-string err)) (error-message-string err))
(insert body))) (insert body)))
(insert body)) (insert body))
(insert "\n") (insert "\n")
(if (mml-validate) (if (mml-validate)
(message-encode-message-body) (message-encode-message-body)
(gnus-message 2 "nnhackernews-request-article: Invalid mml:\n%s" (gnus-message 2 "nnhackernews-request-article: Invalid mml:\n%s"
(buffer-string))) (buffer-string)))