diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index e9e6e0c6c..d5cb93bd4 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -37,7 +37,7 @@ jobs: path: target key: ${{ runner.os }}-cargo-build-target-${{ hashFiles('**/Cargo.lock') }}-${{ matrix.rust_version }} - name: Build - run: cargo build --verbose + run: cargo build --verbose --all --all-features test: runs-on: ubuntu-latest @@ -68,7 +68,7 @@ jobs: path: target key: ${{ runner.os }}-cargo-build-target-${{ hashFiles('**/Cargo.lock') }}-${{ matrix.rust_version }} - name: Run tests - run: cargo test --verbose + run: cargo test --verbose --all --no-fail-fast --all-features --all-targets clippy: runs-on: ubuntu-latest @@ -97,7 +97,7 @@ jobs: path: target key: ${{ runner.os }}-cargo-build-target-${{ hashFiles('**/Cargo.lock') }}-${{ matrix.rust_version }} - name: Run Clippy - run: cargo clippy --all-targets --all-features -- -D warnings + run: cargo clippy --all --tests -- -D warnings fmt: runs-on: ubuntu-latest @@ -120,4 +120,4 @@ jobs: path: target key: ${{ runner.os }}-cargo-build-target-${{ hashFiles('**/Cargo.lock') }}-stable - name: Run fmt - run: cargo fmt -- --check + run: cargo fmt --check --all diff --git a/Makefile b/Makefile index ac6defd1d..0e22aca8d 100644 --- a/Makefile +++ b/Makefile @@ -21,7 +21,7 @@ format: ## Fix formatting and clippy errors test_unit: source test-utils.sh ;\ section "Cargo test" ;\ - cargo test --all --all-features + cargo test --verbose --all --no-fail-fast --all-features --all-targets test_clippy: source test-utils.sh ;\ diff --git a/crates/gosub_html5/src/parser.rs b/crates/gosub_html5/src/parser.rs index 90d297262..4e127874e 100644 --- a/crates/gosub_html5/src/parser.rs +++ b/crates/gosub_html5/src/parser.rs @@ -4245,8 +4245,20 @@ impl<'chars> Html5Parser<'chars> { match rel.as_str() { "stylesheet" => { let href = attributes.get("href").unwrap(); - let base_url = self.document.get().location.clone().unwrap(); - let css_url = base_url.join(href).unwrap(); + let css_url = match Url::parse(href) { + Ok(url) => url, + Err(_err) => { + // Relative URL + if self.document.get().location.is_some() { + let binding = self.document.get(); + let base_url = binding.location.as_ref().unwrap(); + base_url.join(href).unwrap() + } else { + self.parse_error("link element without base url not supported yet"); + return; + } + } + }; println!("loading external stylesheet: {}", css_url); if let Some(stylesheet) = self.load_external_stylesheet(CssOrigin::Author, css_url)