Skip to content

Commit 308d2a9

Browse files
authored
Merge pull request #65 from itowlson/content-type-on-directory-default
Include `content-type` header on directory default
2 parents 175910b + c629815 commit 308d2a9

File tree

3 files changed

+14
-16
lines changed

3 files changed

+14
-16
lines changed

.github/workflows/build.yml

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -14,24 +14,16 @@ jobs:
1414
steps:
1515
- uses: actions/checkout@v2
1616

17-
- name: Install latest Rust stable toolchain
17+
- name: Install Rust
1818
uses: actions-rs/toolchain@v1
1919
with:
20-
toolchain: stable
20+
toolchain: 1.86
2121
default: true
2222
components: clippy, rustfmt
2323

2424
- name: Install Wasm Rust target
2525
run: rustup target add wasm32-wasip1
2626

27-
- name: Install spin-test
28-
run: |
29-
mkdir spin-install
30-
cd spin-install
31-
curl -fsSL https://developer.fermyon.com/downloads/install.sh | bash
32-
sudo mv spin /usr/local/bin/
33-
spin plugin install -u https://github.com/fermyon/spin-test/releases/download/canary/spin-test.json --yes
34-
3527
- name: Install cargo-component
3628
uses: baptiste0928/cargo-install@v3
3729
with:
@@ -40,6 +32,5 @@ jobs:
4032
- name: Make
4133
run: |
4234
make
43-
make spin-test
4435
env:
4536
RUST_LOG: spin=trace

.github/workflows/release.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,10 @@ jobs:
1616
- name: set the release version (tag)
1717
run: echo "RELEASE_VERSION=${GITHUB_REF/refs\/tags\//}" >> $GITHUB_ENV
1818

19-
- name: Install latest Rust stable toolchain
19+
- name: Install Rust
2020
uses: actions-rs/toolchain@v1
2121
with:
22-
toolchain: stable
22+
toolchain: 1.86
2323
default: true
2424
components: clippy, rustfmt
2525

src/lib.rs

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -381,13 +381,20 @@ impl FileServer {
381381

382382
/// Return the media type of the file based on the path.
383383
fn mime(path: &str) -> Option<String> {
384-
match path {
384+
let mut mime = match path {
385385
FAVICON_ICO_FILENAME => mime_guess::from_ext("ico"),
386386
FAVICON_PNG_FILENAME => mime_guess::from_ext("png"),
387387
_ => mime_guess::from_path(path),
388388
}
389-
.first()
390-
.map(|m| m.to_string())
389+
.first();
390+
391+
if mime.is_none() {
392+
if let FileServerPath::Physical(p) = Self::resolve(path) {
393+
mime = mime_guess::from_path(&p).first();
394+
}
395+
}
396+
397+
mime.map(|m| m.to_string())
391398
}
392399

393400
fn make_headers(path: &str, enc: SupportedEncoding, etag: &str) -> Vec<(String, Vec<u8>)> {

0 commit comments

Comments
 (0)