diff --git a/DESCRIPTION b/DESCRIPTION index 2e07b46..3020709 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,7 +1,7 @@ Package: xfun Type: Package Title: Supporting Functions for Packages Maintained by 'Yihui Xie' -Version: 0.50.3 +Version: 0.50.4 Authors@R: c( person("Yihui", "Xie", role = c("aut", "cre", "cph"), email = "xie@yihui.name", comment = c(ORCID = "0000-0003-0645-5666", URL = "https://yihui.org")), person("Wush", "Wu", role = "ctb"), diff --git a/NEWS.md b/NEWS.md index f5544af..748eeed 100644 --- a/NEWS.md +++ b/NEWS.md @@ -2,6 +2,8 @@ - `tojson()` supports more types of data now, and will indent sub-elements for lists. See the help page [`?xfun::tojson`](https://git.yihui.org/xfun/manual.html#sec:man-tojson) for details. +- `upload_imgur()` shows the error message instead of the error code when it fails to upload the image, which is more informative. + # CHANGES IN xfun VERSION 0.50 - The function `isFALSE()` has been removed from this package. The deprecation notice was given two years ago: https://yihui.org/en/2023/02/xfun-isfalse/ diff --git a/R/image.R b/R/image.R index 88ae68a..05ddf1d 100644 --- a/R/image.R +++ b/R/image.R @@ -230,7 +230,7 @@ upload_imgur = function( if (length(link) != 1) stop( 'Failed to upload ', file, sprintf(' (reason: %s)', if (is.character(res)) { grep_sub('.*([^<]+).*', '\\1', res) - } else res[[1]]$error[[1]]) + } else res[[c('data', 'error', 'message')]][[1]]) ) if (include_xml) structure(link, XML = res) else link }