Skip to content

fix: normalize filename handling with migration script#120

Merged
fank merged 3 commits intomainfrom
fix/filename-extension-handling
Feb 3, 2026
Merged

fix: normalize filename handling with migration script#120
fank merged 3 commits intomainfrom
fix/filename-extension-handling

Conversation

@fank
Copy link
Member

@fank fank commented Feb 3, 2026

Summary

  • Normalizes filename handling to strip both .json and .gz extensions
  • Adds migration script for existing deployments

Migration

Run scripts/migrate-filenames.sh after upgrading:

OCAP_DB=/path/to/data.db OCAP_DATA=/path/to/data ./scripts/migrate-filenames.sh

fank added 3 commits February 3, 2026 21:07
Previously, uploaded files like `foo.json.gz` would only have `.gz`
stripped, resulting in filenames like `foo.json` stored in the database
and conversion output directories named `foo.json/`.

Now both extensions are stripped consistently:
- Database stores base name without extensions (e.g., `foo`)
- Files on disk use explicit `.json.gz` extension
- Conversion output directories use clean base name (e.g., `foo/`)

This change requires migration for existing deployments.
Migrates existing deployments from old naming convention to new:
- DB: strips .json suffix from filenames
- Filesystem: renames output directories (foo.json/ -> foo/)
@github-actions
Copy link

github-actions bot commented Feb 3, 2026

Merging this branch changes the coverage (1 decrease, 1 increase)

Impacted Packages Coverage Δ 🤖
github.com/OCAP2/web/cmd/ocap-webserver 16.67% (+0.43%) 👍
github.com/OCAP2/web/internal/conversion 46.44% (ø)
github.com/OCAP2/web/internal/server 44.04% (-0.02%) 👎
github.com/OCAP2/web/internal/storage 57.14% (ø)

Coverage by file

Changed files (no unit tests)

Changed File Coverage Δ Total Covered Missed 🤖
github.com/OCAP2/web/cmd/ocap-webserver/main.go 16.67% (+0.43%) 624 (+8) 104 (+4) 520 (+4) 👍
github.com/OCAP2/web/internal/conversion/worker.go 46.44% (ø) 323 150 173
github.com/OCAP2/web/internal/server/handler.go 39.68% (+0.00%) 741 (+10) 294 (+4) 447 (+6) 👍
github.com/OCAP2/web/internal/storage/json.go 59.91% (ø) 217 130 87

Please note that the "Total", "Covered", and "Missed" counts above refer to code statements instead of lines of code. The value in brackets refers to the test coverage of that file in the old version of the code.

Changed unit test files

  • github.com/OCAP2/web/cmd/ocap-webserver/main_test.go
  • github.com/OCAP2/web/internal/conversion/worker_test.go
  • github.com/OCAP2/web/internal/server/handler_test.go
  • github.com/OCAP2/web/internal/server/integration_test.go
  • github.com/OCAP2/web/internal/storage/json_test.go

@fank fank merged commit 3001e13 into main Feb 3, 2026
2 checks passed
@fank fank deleted the fix/filename-extension-handling branch February 3, 2026 20:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant