pinterest / widgets

JavaScript widgets, including the Pin It button.
Other
211 stars 88 forks source link

pinmarklet & chrome plugin shouldn't delete hash if same #91

Closed fliespl closed 4 years ago

fliespl commented 5 years ago
              if (o.update) {
                debug("Image source changed from " + o.update + " to " + o.src);
                upHash = sha({ str: o.update });
                $.v.data.img[upHash] = $.v.data.img[hash];
                if (o.mod) {
                  $.v.data.img[upHash].mod = o.mod;
                }
                $.v.data.img[upHash].src = o.src;
                $.v.data.img[upHash].height = data.height;
                $.v.data.img[upHash].width = data.width;
                $.v.data.img[hash] = $.v.data.img[upHash];
                $.v.data.img[hash].status = "ok";
                delete $.v.data.img[upHash];
              }

Above code fails to render image when such event occurs:

Image source changed from https://example.com/a.jpg to https://example.com/a.jpg

New hash is the same as the old hash causing image to be removed from grid.

I think it should check if they aren't equal (upHash & hash) prior deleting.

kentbrew commented 4 years ago

Pinmarklet isn't within the scope of this repo, so I'm going to close this. But! We did fix this within pinmarklet recently, which should take care of extensions as well.