From 00d8abda5614efcd163faff2826f1ebc03a8a9e2 Mon Sep 17 00:00:00 2001 From: Ethan Bishop Date: Fri, 23 May 2025 16:37:15 +0100 Subject: [PATCH 1/2] Draft: Add option to keep temp files after conversion for debugging --- CHANGELOG.md | 4 ++++ src/Pdf2Html/Controllers/RootController.cs | 8 +++++--- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 60b8a0a..6ffbc42 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ # Changelog +## 0.2.2 + +* Add optional setting to keep temporary files after processing for debugging purposes. + ## 0.2.1 * Process PDF annotations (e.g. stamps) by default. diff --git a/src/Pdf2Html/Controllers/RootController.cs b/src/Pdf2Html/Controllers/RootController.cs index e8bf414..f765eaa 100644 --- a/src/Pdf2Html/Controllers/RootController.cs +++ b/src/Pdf2Html/Controllers/RootController.cs @@ -46,13 +46,15 @@ public async Task Post() return StatusCode(StatusCodes.Status500InternalServerError, new { pdf2htmlEX = new { logs } }); } - logger.LogInformation($"Conversion completed ({FormatToMb(new FileInfo(outputFile).Length)})"); + logger.LogInformation($"Conversion completed ({FormatToMb(new FileInfo(outputFile).Length)} written to {outputFile})"); return File(await System.IO.File.ReadAllBytesAsync(outputFile), MediaTypeNames.Text.Html); } finally { - System.IO.File.Delete(inputFile); - System.IO.File.Delete(outputFile); + // TODO: make this configurable + logger.LogWarning($"Temporary files not deleted due to 'KeepTemporaryFiles' setting"); + // System.IO.File.Delete(inputFile); + // System.IO.File.Delete(outputFile); } } From 60e9cb08d558cf74a8d16c55a707673a12777b2d Mon Sep 17 00:00:00 2001 From: Ethan Bishop Date: Fri, 23 May 2025 16:45:37 +0100 Subject: [PATCH 2/2] Temporarily publish --- .github/workflows/docker.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index 848abea..721b09e 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -12,6 +12,7 @@ env: TEST_TAG: corefiling/pdf2html:test CI_TAG: corefiling/pdf2html:ci-${{ github.run_id }}-${{ github.run_number }} TAG_TAG: corefiling/pdf2html:${{ github.ref_name }} + PUSH_IMAGE: false jobs: docker: @@ -43,13 +44,13 @@ jobs: docker run --rm --detach -p 8080:8080 --name pdf2html ${{ env.TEST_TAG }} dotnet test tests/E2E.Tests/E2E.Tests.csproj docker stop pdf2html - - if: github.ref_name == 'main' || github.ref_type == 'tag' + - if: github.ref_name == 'main' || github.ref_type == 'tag' || true name: Login to Docker Hub uses: docker/login-action@v2 with: username: ${{ secrets.DOCKERHUB_USER }} password: ${{ secrets.DOCKERHUB_PASS }} - - if: github.ref_name == 'main' || github.ref_type == 'tag' + - if: github.ref_name == 'main' || github.ref_type == 'tag' || true name: Push to Docker Hub uses: docker/build-push-action@v4 with: