Code does not gracefully handle 404 pages
bstincer opened this issue · 1 comments
For some imgur pages, when 404 is hit, file is downloaded, and file is not image/video, seems to be filled with only html code:
Example
Filename: 2021-05-25T102021-EDGEi8B
Contents:
<!doctype html> <title>I'll scrunch my nose, you make me scrunch my toes? - Album on Imgur</title> <script>dataLayer=[];var pbjs=pbjs||{};pbjs.que=pbjs.que||[]</script> <script async="true">!function(){var e=document.createElement("script"),t=document.getElementsByTagName("script")[0],n="https://quantcast.mgr.consensu.org".concat("/choice/","f8oruOqDFlMeI","/","imgur.com","/choice.js"),i=0;e.async=!0,e.type="text/javascript",e.src=n,e.onload=function(){var e=document.createEvent("Event");e.initEvent("cmpLoaded",!0,!0),window.dispatchEvent(e)},t.parentNode.insertBefore(e,t),function(){for(var e,a="__tcfapiLocator",i=[],o=window;o;){try{if(o.frames[a]){e=o;break}}catch(e){}if(o===window.top)break;o=o.parent}e||(function e(){var t=o.document,n=!!o.frames[a];if(!n)if(t.body){var i=t.createElement("iframe");i.style.cssText="display:none",i.name=a,t.body.appendChild(i)}else setTimeout(e,5);return!n}(),o.__tcfapi=function(){var e,t=arguments;if(!t.length)return i;if("setGdprApplies"===t[0])3<t.length&&2===t[2]&&"boolean"==typeof t[3]&&(e=t[3],"function"==typeof t[2]&&t2);else if("ping"===t[0]){var n={gdprApplies:e,cmpLoaded:!1,cmpStatus:"stub"};"function"==typeof t[2]&&t2}else i.push(t)},o.addEventListener("message",function(i){var a="string"==typeof i.data,e={};try{e=a?JSON.parse(i.data):i.data}catch(e){}var o=e.__tcfapiCall;o&&window.__tcfapi(o.command,o.version,function(e,t){var n={__tcfapiReturn:{returnValue:e,success:t,callId:o.callId}};a&&(n=JSON.stringify(n)),i.source.postMessage(n,"*")},o.parameter)},!1))}();var a=function(){var e=arguments;typeof window.__uspapi!==a&&setTimeout(function(){void 0!==window.__uspapi&&window.__uspapi.apply(window.__uspapi,e)},500)};if(void 0===window.__uspapi){window.__uspapi=a;var o=setInterval(function(){i++,window.__uspapi===a&&i<3?console.warn("USP is not accessible"):clearInterval(o)},6e3)}}(),"function"==typeof window.__uspapi&&window.__uspapi("uspPing",1,function(e,t){t&&e.mode.includes("USP")&&e.jurisdiction.includes(e.location.toUpperCase())&&window.__uspapi("setUspDftData",1,function(e,t){t||console.log("Error: USP string not updated!")})})</script> If you're seeing this message, that means JavaScript has been disabled on your browser, please enable JS to make Imgur work.
Can you create a simple use case with a user that has only one image, that has been deleted, and triggers this issue? It would help testing / debugging.