Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

don't freak out on deprecation warnings

The upload API call can sometimes return warnings based on the `watch`
parameter, which has been deprecated in favor of `watchlist`.  When it
does, it returns two XML nodes named `<upload>`, and
`check-api-response` was only looking at the first one.

On my mediawiki (1.19.1), the XML comes back like:

`<api><warnings><upload>...</upload></warnings><upload>...</upload></api>`

We care about the data in the second `<upload>` node.  This patch says
if there are two `<upload>` nodes found, use the second one.

I'm not sure what's the right thing to do here; I could amend
cl-mediawiki to follow the mediawiki API, remove `:watch` and add
`:watchlist`, but that drops support for older mediawiki versions, and
it seems constraining to limit cl-mediawiki to recent mediawiki
versions only.
  • Loading branch information...
commit 5665cd90e9201cb0f965f1629ced453161eddf1d 1 parent 7493290
@ryepup ryepup authored
Showing with 4 additions and 2 deletions.
  1. +4 −2 src/edit.lisp
View
6 src/edit.lisp
@@ -13,8 +13,10 @@ returns values:
"
(check-sxml-for-error xml)
- (let* ((kid (first
- (find-nodes-by-name name xml)))
+ (let* ((matches (find-nodes-by-name name xml))
+ ;; if we have more than match, then odds are we're getting warnings.
+ (kid (if (eq 1 (length matches)) (first matches)
+ (second matches)))
(alist (second kid)))
(unless alist
(error 'media-wiki-error
Please sign in to comment.
Something went wrong with that request. Please try again.