Don't retry when etag is undefined because the page doesn't exist

Follow-up to 5d1a67757a.

Bug: T233320
Change-Id: Ice27187862dde75c69bbdb666c0981fce94249ba
This commit is contained in:
Bartosz Dziewoński 2019-10-21 21:21:15 +02:00
parent 618225d4ed
commit f3dfd98e55

View file

@ -363,7 +363,9 @@
// Adapted from RESTBase mwUtil.parseETag() // Adapted from RESTBase mwUtil.parseETag()
var etagRegexp = /^(?:W\/)?"?([^"/]+)(?:\/([0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}))(?:\/([^"]+))?"?$/; var etagRegexp = /^(?:W\/)?"?([^"/]+)(?:\/([0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}))(?:\/([^"]+))?"?$/;
if ( useRestbase && ( // `etag` is expected to be undefined when creating a new page.
// We can detect that case by `content` being empty, and not retry.
if ( useRestbase && resp.visualeditor.content && (
!resp.visualeditor.etag || !resp.visualeditor.etag ||
!resp.visualeditor.etag.match( etagRegexp ) !resp.visualeditor.etag.match( etagRegexp )
) ) { ) ) {