{"record":{"id":"f8f227c6d7264c2c","repo":"Molunerfinn/PicGo","slug":"please-agree-the-privacy-policy-to-upload","errorCode":null,"errorMessage":"Please agree the privacy policy to upload","messagePattern":"Please agree the privacy policy to upload","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"warning","filePath":"src/main/apis/app/uploader/index.ts","lineNumber":135,"sourceCode":"        return await this.upload([filePath])\n      } else {\n        return await this.upload(imgPath)\n      }\n    } catch (e: any) {\n      logger.error(e)\n      return false\n    } finally {\n      if (filePath) {\n        fse.unlink(filePath)\n      }\n    }\n  }\n\n  async upload (img?: IUploadOption): Promise<ImgInfo[]|false> {\n    try {\n      const privacyCheckRes = await privacyManager.check()\n      if (!privacyCheckRes) {\n        throw Error(T('PRIVACY_TIPS'))\n      }\n      const startTime = Date.now()\n      const output = await picgo.upload(img)\n      if (Array.isArray(output) && output.some((item: ImgInfo) => item.imgUrl)) {\n        if (this.webContents) {\n          dataReportManager.reportUploadData(this.webContents, {\n            fromClipboard: !img,\n            duration: Date.now() - startTime,\n            outputList: output\n          })\n        }\n        return output.filter(item => item.imgUrl)\n      } else {\n        return false\n      }\n    } catch (e: any) {\n      logger.error(e)\n      setTimeout(() => {","sourceCodeStart":117,"sourceCodeEnd":153,"githubUrl":"https://github.com/Molunerfinn/PicGo/blob/07ec7068a5512344da093d49a8408fa63ba3421e/src/main/apis/app/uploader/index.ts#L117-L153","documentation":"The main-process Uploader.upload() checks the user's privacy-policy acceptance via privacyManager.check() before invoking picgo.upload. When the check resolves false (policy not yet agreed), it throws Error(T('PRIVACY_TIPS')), aborting the upload. This is an intentional gate required before any image upload is permitted.","triggerScenarios":"Any upload path — clipboard upload (handleClipboardUploading/uploadWithBuildInClipboard), uploading imgs from the renderer, or direct upload() calls — executed while the user has not accepted the privacy policy, so privacyManager.check() returns false.","commonSituations":"Fresh install where the privacy dialog was dismissed without agreeing; config reset or migration that cleared the acceptance flag; automated/headless uploads (CLI or tests) driving the uploader before any interactive acceptance.","solutions":["Show the privacy policy dialog and record acceptance (privacyManager accept) before triggering uploads.","Set the privacy-agreed flag in appConfig (the same flag privacyManager.check() reads) in automation scenarios.","Catch this error at upload entry points and route the user to the privacy consent UI instead of retrying.","After acceptance, re-run the upload — no other state is needed since the check is the only gate."],"exampleFix":"// before\nconst output = await uploader.upload(img)\n\n// after\nif (!(await privacyManager.check())) {\n  const agreed = await promptPrivacyPolicyDialog()\n  if (!agreed) return false\n}\nconst output = await uploader.upload(img)","handlingStrategy":"validation","validationCode":"if (!(await privacyManager.check())) {\n  // show privacy dialog and persist acceptance before uploading\n  await showPrivacyPolicyDialog()\n}","typeGuard":"function canUpload(privacyCheckRes: unknown): privacyCheckRes is true {\n  return privacyCheckRes === true\n}","tryCatchPattern":"try {\n  const output = await uploader.upload(img)\n} catch (err) {\n  if ((err as Error).message === T('PRIVACY_TIPS')) {\n    // route user to privacy consent UI, then optionally retry\n    showPrivacyPolicyDialog()\n  }\n}","preventionTips":["Always gate upload entry points behind a privacyManager.check() pass.","Persist the acceptance flag so restarts and automations inherit it.","In headless/CLI flows, set the agreed flag programmatically before calling upload.","Do not retry uploads on this error — obtain consent first, then retry once."],"tags":["privacy","upload","consent","main-process"],"backgroundTag":"privacy-policy-not-accepted","analyzedSha":"07ec7068a5512344da093d49a8408fa63ba3421e","analyzedAt":"2026-08-30T01:45:22.289Z","schemaVersion":2},"datasetVersion":"2026-08-30T03:17:51.788Z"}