From ca5856829bc2dcf937aab92b124b6fe316352c6d Mon Sep 17 00:00:00 2001 From: AI Assistant Date: Mon, 9 Mar 2026 11:24:56 +0200 Subject: [PATCH] fix(dwg): correct ODA download URL + dynamic binary path lookup - Use www.opendesign.com/guestfiles/get URL (no auth required) - Auto-find and symlink ODA binary after dpkg install - app.py searches multiple common install paths Co-Authored-By: Claude Opus 4.6 --- dwg2dxf-api/Dockerfile | 13 ++++++++----- dwg2dxf-api/app.py | 10 ++++++++-- 2 files changed, 16 insertions(+), 7 deletions(-) diff --git a/dwg2dxf-api/Dockerfile b/dwg2dxf-api/Dockerfile index f07e1f8..03180da 100644 --- a/dwg2dxf-api/Dockerfile +++ b/dwg2dxf-api/Dockerfile @@ -1,6 +1,6 @@ FROM ubuntu:24.04 -# ODA File Converter needs Qt libs + virtual framebuffer for headless mode +# Qt libs + virtual framebuffer for headless ODA File Converter RUN apt-get update && \ apt-get install -y --no-install-recommends \ python3 python3-pip wget ca-certificates \ @@ -10,14 +10,17 @@ RUN apt-get update && \ libglib2.0-0 libgl1 libfontconfig1 libfreetype6 && \ pip3 install --no-cache-dir --break-system-packages flask && \ apt-get purge -y python3-pip && \ - apt-get autoremove -y && \ - rm -rf /var/lib/apt/lists/* + apt-get autoremove -y # Download and install ODA File Converter -RUN wget -q "https://download.opendesign.com/guestfiles/Demo/ODAFileConverter_QT6_lnxX64_8.3dll_25.12.deb" \ +RUN wget -q "https://www.opendesign.com/guestfiles/get?filename=ODAFileConverter_QT6_lnxX64_8.3dll_27.1.deb" \ -O /tmp/oda.deb && \ dpkg -i /tmp/oda.deb || apt-get install -f -y && \ - rm /tmp/oda.deb + rm /tmp/oda.deb && \ + rm -rf /var/lib/apt/lists/* && \ + # Find the binary and symlink to /usr/local/bin for PATH access + find / -name "ODAFileConverter" -type f -executable 2>/dev/null | head -1 | \ + xargs -I{} ln -sf {} /usr/local/bin/ODAFileConverter WORKDIR /app COPY app.py . diff --git a/dwg2dxf-api/app.py b/dwg2dxf-api/app.py index 993da66..cfee37f 100644 --- a/dwg2dxf-api/app.py +++ b/dwg2dxf-api/app.py @@ -13,8 +13,14 @@ app = Flask(__name__) MAX_FILE_SIZE = 100 * 1024 * 1024 # 100 MB -# ODA File Converter installs here on Ubuntu -ODA_BIN = "/usr/bin/ODAFileConverter" +# ODA File Converter — try common install paths +ODA_BIN = "/usr/local/bin/ODAFileConverter" +for _p in ["/usr/local/bin/ODAFileConverter", "/usr/bin/ODAFileConverter", + "/opt/ODAFileConverter/ODAFileConverter", + "/opt/oda-file-converter/ODAFileConverter"]: + if os.path.isfile(_p): + ODA_BIN = _p + break @app.route("/health", methods=["GET"])