Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,8 @@ debug/
/test_*.py

# Bundled web UI (built artifact — not source)
src/SVG2DrawIOLib/web/
src/SVG2DrawIOLib/web/*
!src/SVG2DrawIOLib/web/.gitkeep

# web-ui (Next.js)
web-ui/node_modules/
Expand Down
14 changes: 12 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,22 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [1.3.1] - 2026-02-22
## [1.3.2] - 2026-02-22

### Fixed

- **Editable install compatibility**: Added `.gitkeep` placeholder file in `src/SVG2DrawIOLib/web/` directory to enable editable installs (`pip install -e .`) to work before the web UI is built. This fixes CI/CD workflows that install in editable mode for testing before building the web UI.
- **Web UI packaging**: Fixed `pyproject.toml` hatchling configuration to properly include the web UI static files in the built wheel and sdist. Changed from `artifacts` to `force-include` configuration for both wheel and sdist targets. The web UI directory (`src/SVG2DrawIOLib/web/`) is now correctly included in PyPI releases, ensuring `pip install SVG2DrawIOLib[web]` followed by `svg2drawiolib web` works out of the box.

### Changed

- **`.gitignore`**: Updated web directory exclusion pattern to allow `.gitkeep` placeholder file while still ignoring all build artifacts.
- **`Makefile`**: Updated `build-release` target to preserve `.gitkeep` file when copying web UI build artifacts.

## [1.3.1] - 2026-02-22

### Fixed

- **Security: Data URI sanitization** (Bug #27): Updated SVG sanitization to only block dangerous data: URIs (`data:text/html`, `data:text/javascript`, `data:application/javascript`, `data:application/x-javascript`) while allowing safe image data: URIs (`data:image/png`, `data:image/jpeg`, `data:image/svg+xml`, etc.) for legitimate embedded images.
- **Security: Case-insensitive element filtering** (Bug #28): Made dangerous element checking case-insensitive to prevent sanitization bypass via case variants like `<Script>`, `<SCRIPT>`, or `<ForeignObject>`. Updated `_DANGEROUS_ELEMENTS` set to store lowercase values and added `.lower()` call during comparison.
- **API: Duplicate error handling** (Bug #29): Extracted duplicate library error handling logic into shared `handle_library_value_error()` helper function in `processing.py`. Updated five routers (`add`, `remove`, `list`, `extract`, `inspect`) to use the centralized helper, eliminating code duplication.
Expand All @@ -20,7 +31,6 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

### Changed

- **`pyproject.toml`**: Updated hatchling build configuration to use `force-include` for web UI static files in both wheel and sdist targets, replacing the non-functional `artifacts` configuration. Added explicit `packages` declaration and sdist `include` list.
- **Web UI default**: Changed "Inject CSS classes" checkbox default from `false` to `true` in both CreateTab and ManageTab components for better out-of-box experience.

## [1.3.0] - 2026-02-21
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ build-web: ## Build Next.js static export into web-ui/out/ (required before svg2
cd web-ui && npm run build

build-release: build-web ## Build Next.js UI and copy into the Python package for distribution
uv run python -c "import shutil,pathlib; w=pathlib.Path('src/SVG2DrawIOLib/web'); shutil.rmtree(w,ignore_errors=True); shutil.copytree('web-ui/out',w); [(p.rename(p.parent.parent/(p.parent.name+'.__PAGE__.txt')),p.parent.rmdir()) for p in list(w.rglob('__PAGE__.txt')) if p.parent.name.startswith('__next.')]"
uv run python -c "import shutil,pathlib; w=pathlib.Path('src/SVG2DrawIOLib/web'); gitkeep=w/'.gitkeep'; gitkeep_content=gitkeep.read_text() if gitkeep.exists() else ''; shutil.rmtree(w,ignore_errors=True); shutil.copytree('web-ui/out',w); [(p.rename(p.parent.parent/(p.parent.name+'.__PAGE__.txt')),p.parent.rmdir()) for p in list(w.rglob('__PAGE__.txt')) if p.parent.name.startswith('__next.')]; w.mkdir(exist_ok=True); gitkeep.write_text(gitkeep_content) if gitkeep_content else None"
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Empty .gitkeep file won't be preserved during build

Low Severity

The build-release logic conflates "file exists with empty content" and "file doesn't exist." The variable gitkeep_content is used both to track existence and content, but an empty .gitkeep (the standard convention) produces '', which is falsy. The final conditional gitkeep.write_text(gitkeep_content) if gitkeep_content else None then skips recreating it. A separate boolean tracking existence is needed so that empty .gitkeep files are also preserved.

Fix in Cursor Fix in Web


start-web: build-web ## Build then launch the web UI via the CLI (opens browser)
svg2drawio web
4 changes: 4 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,10 @@ include = [
[tool.hatch.build.targets.sdist.force-include]
"src/SVG2DrawIOLib/web" = "src/SVG2DrawIOLib/web"

# Editable installs work without the web directory
[tool.hatch.build.targets.editable]
packages = ["src/SVG2DrawIOLib"]

[tool.hatch.envs.default]
dependencies = [
"pytest>=8.0.0",
Expand Down
2 changes: 1 addition & 1 deletion src/SVG2DrawIOLib/__about__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
"""Package version information."""

__version__ = "1.3.1"
__version__ = "1.3.2"
2 changes: 2 additions & 0 deletions src/SVG2DrawIOLib/web/.gitkeep
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Placeholder for web UI build artifacts
# The actual web UI is built from web-ui/ and copied here during release builds
Loading