{"record":{"id":"8473bce6310b2cab","repo":"phacility/phabricator","slug":"unsupported-data-encoding","errorCode":null,"errorMessage":"Unsupported data encoding.","messagePattern":"Unsupported data encoding\\.","errorType":"exception","errorClass":"Exception","httpStatus":null,"severity":"error","filePath":"src/applications/files/conduit/FileUploadChunkConduitAPIMethod.php","lineNumber":44,"sourceCode":"\n  protected function execute(ConduitAPIRequest $request) {\n    $viewer = $request->getUser();\n\n    $file_phid = $request->getValue('filePHID');\n    $file = $this->loadFileByPHID($viewer, $file_phid);\n\n    $start = $request->getValue('byteStart');\n\n    $data = $request->getValue('data');\n    $encoding = $request->getValue('dataEncoding');\n    switch ($encoding) {\n      case 'base64':\n        $data = $this->decodeBase64($data);\n        break;\n      case null:\n        break;\n      default:\n        throw new Exception(pht('Unsupported data encoding.'));\n    }\n    $length = strlen($data);\n\n    $chunk = $this->loadFileChunkForUpload(\n      $viewer,\n      $file,\n      $start,\n      $start + $length);\n\n    // If this is the initial chunk, leave the MIME type unset so we detect\n    // it and can update the parent file. If this is any other chunk, it has\n    // no meaningful MIME type. Provide a default type so we can avoid writing\n    // it to disk to perform MIME type detection.\n    if (!$start) {\n      $mime_type = null;\n    } else {\n      $mime_type = 'application/octet-stream';\n    }","sourceCodeStart":26,"sourceCodeEnd":62,"githubUrl":"https://github.com/phacility/phabricator/blob/5720a38cfe95b00ca4be5016dd0d2f3195f4fa04/src/applications/files/conduit/FileUploadChunkConduitAPIMethod.php#L26-L62","documentation":"Encoding whitelist guard in the chunk upload conduit method: dataEncoding is neither 'base64' nor null/omitted. Only those two encodings are supported, so any other declared encoding for the chunk data is rejected before decoding.","triggerScenarios":"Thrown at src/applications/files/conduit/FileUploadChunkConduitAPIMethod.php:44 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Set dataEncoding to 'base64' or omit it entirely","Do not invent other encoding values in the conduit request"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"5720a38cfe95b00ca4be5016dd0d2f3195f4fa04","analyzedAt":"2026-08-21T05:07:25.672Z","contentChangedAt":"2026-08-21T05:07:25.672Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}