404 errors with every upload
I keep on being shown 404 errors in the UI when I upload new projects.
I am using docker version 1.5.2. UI looks all good, but when I use the project uploaded via UI, or docatl, nothing seems to be inserted successfully, or at least it cannot be shown.
I tried uploading the following items converted to .zip
- single index.html file
- complete sphinxs output directory
- pdf file
- example directory under /docs in DOCATL repo
None of them seem to be able to be rendered after the upload.
Can you share an example of what you upload?
reopen when applicable
I ran into this same problem, and it was driving me crazy. The website upload would work but not the scripted one using requests.
The root cause was whitespace at the end of the version. In the image, one of the 0.1.0 was uploaded with \n at the end.
Here is the code that was causing the problem if you want to try it
from pathlib import Path
from zipfile import ZIP_DEFLATED, ZipFile
import requests
cwd = Path.cwd()
docs_dirs = cwd / "build"
zip_path = cwd / "docs.zip"
with ZipFile(zip_path, "w", ZIP_DEFLATED) as zip_file:
for item in docs_dirs.rglob("*"):
relative_name = item.relative_to(docs_dirs)
zip_file.write(item, arcname=relative_name)
# this is broken, results in a 404 while trying to access the documentation.
version = subprocess.run(["poetry", "version", "-s"], check=True, capture_output=True, text=True).stdout
# This fixes the issue
# version = subprocess.run(["poetry", "version", "-s"], check=True, capture_output=True, text=True).stdout.strip()
project_url = f"https://..../api/test_projct/{version}"
with zip_path.open("rb") as zip_file:
response = requests.post(project_url, files={"file": zip_file})
response.raise_for_status()
Fair enough i guess we could restrict whitespace characters in front and after the version itself.