0

I'm trying to logout file information that is being uploaded through the browser with a chrome extension. In V3.

Minimal steps to reproduce:

background.js

chrome.webRequest.onBeforeRequest.addListener(
  (details) => {
    if (details.method.toUpperCase() !== "POST") return;
    if (!details.requestBody) return;

    if (details.url.includes("put_block")) {
      console.log(details);
    }
  },
  { urls: ["<all_urls>"] },
  ["requestBody"]
);

console.log:

{
...
requestBody: { error: 'Unknown error.' },
...
}

  • I'm testing my extension by uploading images to dropbox
  • When looking at the network tab I can see a post-request with this payload to:

https://dl-web.dropbox.com/put_block_returning_token?...

enter image description here

requestBody: { error: 'Unknown error.' },


how come I can't get anything meaningful in the service worker?

Salmin Skenderovic
  • 1,750
  • 9
  • 22
  • Same issue in v2 – Salmin Skenderovic Jan 06 '23 at 18:19
  • 1
    https://crbug.com/976174. The workaround is to override the upload method in [page context](/a/9517879). – wOxxOm Jan 06 '23 at 18:31
  • That might be a workaround, but it seems hacky since what I want is something that is there in the API. The other regular requests displays the postData. Some even do it with ArrayBuffers. But this particular one just shows an error... could this be due to some encryption dropbox uses? either way I would still want to see something other than "error" – Salmin Skenderovic Jan 06 '23 at 18:57
  • It's a bug in the API when the data is uploaded as a form or FormData so the only solution is to not use the API i.e. the workaround is the only way. – wOxxOm Jan 06 '23 at 19:14

0 Answers0