theonedev/onedev · error · ExplicitException
Invalid artifact request path
Error message
Invalid artifact request path
What it means
Guard in TodResource's build-report/artifact endpoints: the supplied artifactPath does not conform to the expected format, so the artifact request cannot be resolved against the build's published artifacts.
Source
Thrown at server-core/src/main/java/io/onedev/server/ai/TodResource.java:929
@Path("/get-build-unit-test-report")
@GET
public Response getBuildUnitTestReport(
@QueryParam("currentProject") @NotNull String currentProjectPath,
@QueryParam("reference") @NotNull String buildReference,
@QueryParam("reportName") @NotNull String reportName,
@QueryParam("artifactPath") String artifactPath) {
if (SecurityUtils.getUser() == null)
throw new UnauthenticatedException();
var currentProject = getProject(currentProjectPath);
var build = getBuild(currentProject, buildReference);
if (!SecurityUtils.canAccessReport(build, reportName))
throw new UnauthorizedException("No permission to access report: " + reportName);
if (artifactPath != null) {
if (reportName.contains("..") || artifactPath.contains("..")
|| !artifactPath.startsWith(UnitTestReport.ARTIFACTS + "/")) {
throw new ExplicitException("Invalid artifact request path");
}
String mediaType;
try {
mediaType = MimeUtils.sanitize(Files.probeContentType(Paths.get(artifactPath)));
} catch (IOException e) {
throw new RuntimeException(e);
}
String fileName = StringUtils.substringAfterLast(artifactPath, "/");
var projectId = build.getProject().getId();
var buildNumber = build.getNumber();
StreamingOutput streamingOutput = os -> UnitTestReport.downloadArtifact(
projectId, buildNumber, reportName, artifactPath, os);
return Response.ok(streamingOutput, mediaType)
.header("X-Content-Type-Options", "nosniff")
.header("Content-Disposition", "attachment; filename=\""
+ URLEncoder.encode(fileName, StandardCharsets.UTF_8) + "\"")
.build();
} else {View on GitHub (pinned to d44925c47c)
Solutions
- Use the artifact path exactly as reported by the build's publish step.
- Omit artifactPath to get the root listing, or pass a valid relative path within the artifacts directory.
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at server-core/src/main/java/io/onedev/server/ai/TodResource.java:929 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of theonedev/onedev@d44925c47c (2026-09-06).
Data as JSON: /api/errors/c4712db789212124.
Report an issue: GitHub.