Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Middleware skips some mimetype #660

Closed
ahdyt opened this issue Jan 13, 2024 · 3 comments
Closed

Middleware skips some mimetype #660

ahdyt opened this issue Jan 13, 2024 · 3 comments

Comments

@ahdyt
Copy link

ahdyt commented Jan 13, 2024

Hi there I'm using the minify Middleware and would like to skip some mimetype like image/png, because it's causing error. Is there any docs about it?

@ahdyt ahdyt closed this as completed Jan 14, 2024
@tdewolff
Copy link
Owner

Was this fixed or was it never a problem?

@ahdyt
Copy link
Author

ahdyt commented Jan 14, 2024

Hi, I end up using below workaround, would be good if there's cleaner option. For a mimetype with binary(e.g. image/png image/jpg) I think error, because it's not minified, instead it's deleted? image/svg is fine because it's plain text

`go

var fs http.Handler
if strings.Contains(r.URL.Path, ".html") || strings.Contains(r.URL.Path, ".css") || strings.Contains(r.URL.Path, ".js") || strings.Contains(r.URL.Path, ".svg") || strings.Contains(r.URL.Path, ".json") {
fs = http.StripPrefix(pathPrefix, minify.Middleware(http.FileServer(root)))
} else {
fs = http.StripPrefix(pathPrefix, http.FileServer(root))
}
fs.ServeHTTP(w, r)
`

tdewolff added a commit that referenced this issue Jan 25, 2024
…extension or supported Content-Type header, fixes #660
@tdewolff
Copy link
Owner

I've pushed a fix so that unsupported mediatypes (extension or Content-Type) are passed without minification.

kodiakhq bot referenced this issue in cloudquery/codegen Feb 1, 2024
)

This PR contains the following updates:

| Package | Type | Update | Change |
|---|---|---|---|
| [github.com/tdewolff/minify/v2](https://github.com/tdewolff/minify) | indirect | patch | `v2.20.14` -> `v2.20.16` |

---

> [!WARNING]
> Some dependencies could not be looked up. Check the Dependency Dashboard for more information.

---

### Release Notes

<details>
<summary>tdewolff/minify (github.com/tdewolff/minify/v2)</summary>

### [`v2.20.16`](https://github.com/tdewolff/minify/releases/tag/v2.20.16)

[Compare Source](https://github.com/tdewolff/minify/compare/v2.20.15...v2.20.16)

-   [cmd: revert to report error when specified file has no extension for a minifier](https://github.com/tdewolff/minify/commit/b082f0427cff58d2bd8cba3c38c9a1bbc3da79a5)
-   [JS: fix memory bug with bang-comments](https://github.com/tdewolff/minify/commit/577ab958a3172d8fceb2e1b36ab7b18aeb675f03)

### [`v2.20.15`](https://github.com/tdewolff/minify/releases/tag/v2.20.15)

[Compare Source](https://github.com/tdewolff/minify/compare/v2.20.14...v2.20.15)

-   [Fix ResponseWriter to not minify if there is no supported RequestURI extension or supported Content-Type header, fixes](https://github.com/tdewolff/minify/commit/f9aa0ad0c35a277f044a0c72b99db68bc4c66d36) [https://github.com/tdewolff/minify/issues/660](https://github.com/tdewolff/minify/issues/660)
-   [JS: fix parsing of comments in expressions and keep all bang-comments at the top of the statement list, fixes](https://github.com/tdewolff/minify/commit/d3022691eef0ee5fb68f34222167acdbc88abb7e) [https://github.com/tdewolff/minify/issues/664](https://github.com/tdewolff/minify/issues/664)
-   [cmd: fix printing an error when writing to directory but it doesn't exist](https://github.com/tdewolff/minify/commit/8b9a65f91bb850c2c425b74dc4f962adba525334)
-   [cmd: add Debug logging class, don't print error when can't infer mimetype from input but is excluded by --exclude](https://github.com/tdewolff/minify/commit/fcf5661e818c9275fd45370d94e94d7eec08b45e)
-   cmd: update argp package with some fixes

</details>

---

### Configuration

📅 **Schedule**: Branch creation - "before 4am on the first day of the month" (UTC), Automerge - At any time (no schedule defined).

🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update again.

---

 - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box

---

This PR has been generated by [Renovate Bot](https://github.com/renovatebot/renovate).
<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNy4xNjMuMiIsInVwZGF0ZWRJblZlciI6IjM3LjE2My4yIiwidGFyZ2V0QnJhbmNoIjoibWFpbiJ9-->
kodiakhq bot referenced this issue in cloudquery/filetypes Feb 1, 2024
)

This PR contains the following updates:

| Package | Type | Update | Change |
|---|---|---|---|
| [github.com/tdewolff/minify/v2](https://github.com/tdewolff/minify) | indirect | patch | `v2.20.14` -> `v2.20.16` |

---

> [!WARNING]
> Some dependencies could not be looked up. Check the Dependency Dashboard for more information.

---

### Release Notes

<details>
<summary>tdewolff/minify (github.com/tdewolff/minify/v2)</summary>

### [`v2.20.16`](https://github.com/tdewolff/minify/releases/tag/v2.20.16)

[Compare Source](https://github.com/tdewolff/minify/compare/v2.20.15...v2.20.16)

-   [cmd: revert to report error when specified file has no extension for a minifier](https://github.com/tdewolff/minify/commit/b082f0427cff58d2bd8cba3c38c9a1bbc3da79a5)
-   [JS: fix memory bug with bang-comments](https://github.com/tdewolff/minify/commit/577ab958a3172d8fceb2e1b36ab7b18aeb675f03)

### [`v2.20.15`](https://github.com/tdewolff/minify/releases/tag/v2.20.15)

[Compare Source](https://github.com/tdewolff/minify/compare/v2.20.14...v2.20.15)

-   [Fix ResponseWriter to not minify if there is no supported RequestURI extension or supported Content-Type header, fixes](https://github.com/tdewolff/minify/commit/f9aa0ad0c35a277f044a0c72b99db68bc4c66d36) [https://github.com/tdewolff/minify/issues/660](https://github.com/tdewolff/minify/issues/660)
-   [JS: fix parsing of comments in expressions and keep all bang-comments at the top of the statement list, fixes](https://github.com/tdewolff/minify/commit/d3022691eef0ee5fb68f34222167acdbc88abb7e) [https://github.com/tdewolff/minify/issues/664](https://github.com/tdewolff/minify/issues/664)
-   [cmd: fix printing an error when writing to directory but it doesn't exist](https://github.com/tdewolff/minify/commit/8b9a65f91bb850c2c425b74dc4f962adba525334)
-   [cmd: add Debug logging class, don't print error when can't infer mimetype from input but is excluded by --exclude](https://github.com/tdewolff/minify/commit/fcf5661e818c9275fd45370d94e94d7eec08b45e)
-   cmd: update argp package with some fixes

</details>

---

### Configuration

📅 **Schedule**: Branch creation - "before 4am on the first day of the month" (UTC), Automerge - At any time (no schedule defined).

🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update again.

---

 - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box

---

This PR has been generated by [Renovate Bot](https://github.com/renovatebot/renovate).
<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNy4xNjMuMiIsInVwZGF0ZWRJblZlciI6IjM3LjE2My4yIiwidGFyZ2V0QnJhbmNoIjoibWFpbiJ9-->
kodiakhq bot referenced this issue in cloudquery/plugin-sdk Feb 1, 2024
…1511)

This PR contains the following updates:

| Package | Type | Update | Change |
|---|---|---|---|
| [github.com/tdewolff/minify/v2](https://github.com/tdewolff/minify) | indirect | patch | `v2.20.14` -> `v2.20.16` |

---

> [!WARNING]
> Some dependencies could not be looked up. Check the Dependency Dashboard for more information.

---

### Release Notes

<details>
<summary>tdewolff/minify (github.com/tdewolff/minify/v2)</summary>

### [`v2.20.16`](https://github.com/tdewolff/minify/releases/tag/v2.20.16)

[Compare Source](https://github.com/tdewolff/minify/compare/v2.20.15...v2.20.16)

-   [cmd: revert to report error when specified file has no extension for a minifier](https://github.com/tdewolff/minify/commit/b082f0427cff58d2bd8cba3c38c9a1bbc3da79a5)
-   [JS: fix memory bug with bang-comments](https://github.com/tdewolff/minify/commit/577ab958a3172d8fceb2e1b36ab7b18aeb675f03)

### [`v2.20.15`](https://github.com/tdewolff/minify/releases/tag/v2.20.15)

[Compare Source](https://github.com/tdewolff/minify/compare/v2.20.14...v2.20.15)

-   [Fix ResponseWriter to not minify if there is no supported RequestURI extension or supported Content-Type header, fixes](https://github.com/tdewolff/minify/commit/f9aa0ad0c35a277f044a0c72b99db68bc4c66d36) [https://github.com/tdewolff/minify/issues/660](https://github.com/tdewolff/minify/issues/660)
-   [JS: fix parsing of comments in expressions and keep all bang-comments at the top of the statement list, fixes](https://github.com/tdewolff/minify/commit/d3022691eef0ee5fb68f34222167acdbc88abb7e) [https://github.com/tdewolff/minify/issues/664](https://github.com/tdewolff/minify/issues/664)
-   [cmd: fix printing an error when writing to directory but it doesn't exist](https://github.com/tdewolff/minify/commit/8b9a65f91bb850c2c425b74dc4f962adba525334)
-   [cmd: add Debug logging class, don't print error when can't infer mimetype from input but is excluded by --exclude](https://github.com/tdewolff/minify/commit/fcf5661e818c9275fd45370d94e94d7eec08b45e)
-   cmd: update argp package with some fixes

</details>

---

### Configuration

📅 **Schedule**: Branch creation - "before 4am on the first day of the month" (UTC), Automerge - At any time (no schedule defined).

🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update again.

---

 - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box

---

This PR has been generated by [Renovate Bot](https://github.com/renovatebot/renovate).
<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNy4xNjMuMiIsInVwZGF0ZWRJblZlciI6IjM3LjE2My4yIiwidGFyZ2V0QnJhbmNoIjoibWFpbiJ9-->
kodiakhq bot referenced this issue in cloudquery/plugin-pb-go Feb 1, 2024
)

This PR contains the following updates:

| Package | Type | Update | Change |
|---|---|---|---|
| [github.com/tdewolff/minify/v2](https://github.com/tdewolff/minify) | indirect | patch | `v2.20.14` -> `v2.20.16` |

---

> [!WARNING]
> Some dependencies could not be looked up. Check the Dependency Dashboard for more information.

---

### Release Notes

<details>
<summary>tdewolff/minify (github.com/tdewolff/minify/v2)</summary>

### [`v2.20.16`](https://github.com/tdewolff/minify/releases/tag/v2.20.16)

[Compare Source](https://github.com/tdewolff/minify/compare/v2.20.15...v2.20.16)

-   [cmd: revert to report error when specified file has no extension for a minifier](https://github.com/tdewolff/minify/commit/b082f0427cff58d2bd8cba3c38c9a1bbc3da79a5)
-   [JS: fix memory bug with bang-comments](https://github.com/tdewolff/minify/commit/577ab958a3172d8fceb2e1b36ab7b18aeb675f03)

### [`v2.20.15`](https://github.com/tdewolff/minify/releases/tag/v2.20.15)

[Compare Source](https://github.com/tdewolff/minify/compare/v2.20.14...v2.20.15)

-   [Fix ResponseWriter to not minify if there is no supported RequestURI extension or supported Content-Type header, fixes](https://github.com/tdewolff/minify/commit/f9aa0ad0c35a277f044a0c72b99db68bc4c66d36) [https://github.com/tdewolff/minify/issues/660](https://github.com/tdewolff/minify/issues/660)
-   [JS: fix parsing of comments in expressions and keep all bang-comments at the top of the statement list, fixes](https://github.com/tdewolff/minify/commit/d3022691eef0ee5fb68f34222167acdbc88abb7e) [https://github.com/tdewolff/minify/issues/664](https://github.com/tdewolff/minify/issues/664)
-   [cmd: fix printing an error when writing to directory but it doesn't exist](https://github.com/tdewolff/minify/commit/8b9a65f91bb850c2c425b74dc4f962adba525334)
-   [cmd: add Debug logging class, don't print error when can't infer mimetype from input but is excluded by --exclude](https://github.com/tdewolff/minify/commit/fcf5661e818c9275fd45370d94e94d7eec08b45e)
-   cmd: update argp package with some fixes

</details>

---

### Configuration

📅 **Schedule**: Branch creation - "before 4am on the first day of the month" (UTC), Automerge - At any time (no schedule defined).

🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update again.

---

 - [x] <!-- rebase-check -->If you want to rebase/retry this PR, check this box

---

This PR has been generated by [Renovate Bot](https://github.com/renovatebot/renovate).
<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNy4xNjMuMiIsInVwZGF0ZWRJblZlciI6IjM3LjE2My4yIiwidGFyZ2V0QnJhbmNoIjoibWFpbiJ9-->
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants