-
-
Notifications
You must be signed in to change notification settings - Fork 203
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Bug] Call to getBookPage fails with 406 when using documented media type #350
Comments
I think it's a Swagger issue, if you look at the code:
The media type is set for the response, not for the request. I noticed this kind of thing before, where it's difficult to have accurate Swagger documentation for dynamic content. Here the actual return type is a ByteArray, but contains an image, and thus the media type is I honestly don't have time to spend on the Swagger annotations to make it work, but if you feel like sending a PR, please do 🙏 |
Ok, then the Swagger doc looks correct (i.e. if the With the piece of code you posted + searching on the web for the error message I got in the log:
I'm wondering if the fix something like that: --- a/komga/src/main/kotlin/org/gotson/komga/interfaces/rest/BookController.kt
+++ b/komga/src/main/kotlin/org/gotson/komga/interfaces/rest/BookController.kt
@@ -298,7 +298,8 @@ class BookController(
@GetMapping(value = [
"api/v1/books/{bookId}/pages/{pageNumber}",
"opds/v1.2/books/{bookId}/pages/{pageNumber}"
- ])
+ ], produces = ["image/*"]
+ )
@PreAuthorize("hasRole('$ROLE_PAGE_STREAMING')")
fun getBookPage(
@AuthenticationPrincipal principal: KomgaPrincipal, Are there instructions somewhere on how to build Komga from the source code? |
Check the Readme 😉 |
Found it 😉 I can confirm that it works with the fix I mentioned --- a/komga/src/main/kotlin/org/gotson/komga/interfaces/rest/BookController.kt
+++ b/komga/src/main/kotlin/org/gotson/komga/interfaces/rest/BookController.kt
@@ -298,7 +298,7 @@ class BookController(
@GetMapping(value = [
"api/v1/books/{bookId}/pages/{pageNumber}",
"opds/v1.2/books/{bookId}/pages/{pageNumber}"
- ])
+ ], produces = ["image/*"])
@PreAuthorize("hasRole('$ROLE_PAGE_STREAMING')")
fun getBookPage(
@AuthenticationPrincipal principal: KomgaPrincipal, Both with
and
That being said, seems like this break an existing test: |
You can send a PR, I'll have a look! |
* fix(api): support accept header in getBookPage API is documented as supporting `accept: image/*` in the HTTP request, but doing so results in server response with the status 406. This commit updates the `GetMapping` annotation to correctly support these values in the HTTP `accept` header. closes #350 * fix: failing test Co-authored-by: Gauthier Roebroeck <gauthier.roebroeck@gmail.com>
🎉 This issue has been resolved in version 0.64.4 🎉 The release is available on:
Your semantic-release bot 📦🚀 |
# [0.30.0](v0.29.1...v0.30.0) (2021-01-06) ### Bug Fixes * fix sqlite library detection for aarch64 ([10df531](10df531)) * **opds:** duplicate series if in multiple collections ([c7e6209](c7e6209)), closes [gotson#363](https://github.com/tahngarth/komga/issues/363) * don't append volume to series title if equals to 1 ([1cb9ae6](1cb9ae6)), closes [gotson#347](https://github.com/tahngarth/komga/issues/347) * enhanced logging for sqlite native lib loading ([f1a894d](f1a894d)) * scanner crashes if folders are not readable ([f43a386](f43a386)), closes [gotson#342](https://github.com/tahngarth/komga/issues/342) * use bionic base image ([85fe674](85fe674)), closes [gotson#349](https://github.com/tahngarth/komga/issues/349) * **api:** support accept header in getBookPage ([gotson#352](https://github.com/tahngarth/komga/issues/352)) ([e123d38](e123d38)), closes [gotson#350](https://github.com/tahngarth/komga/issues/350) * native webp library ([15caea3](15caea3)), closes [gotson#279](https://github.com/tahngarth/komga/issues/279) * use own distrib of sqlite with freebsd support ([3d2793a](3d2793a)), closes [gotson#319](https://github.com/tahngarth/komga/issues/319) * **api:** incorrect parameter type ([342f04c](342f04c)) * **api:** large file download ([d100db2](d100db2)) * **api:** openAPI spec fields marked as required ([8f228db](8f228db)), closes [gotson#308](https://github.com/tahngarth/komga/issues/308) * **opds:** cannot download file with semicolon in filename ([e1e251e](e1e251e)), closes [gotson#309](https://github.com/tahngarth/komga/issues/309) * **opds:** latest series sort inverted ([bddc008](bddc008)), closes [gotson#301](https://github.com/tahngarth/komga/issues/301) * **opds:** url encode publisher query param ([8347fdc](8347fdc)), closes [gotson#335](https://github.com/tahngarth/komga/issues/335) * **webreader:** images smaller than viewport would not fill width ([81d9a00](81d9a00)), closes [gotson#311](https://github.com/tahngarth/komga/issues/311) * trim and lowercase tags and genres in metadata ([656f23a](656f23a)), closes [gotson#302](https://github.com/tahngarth/komga/issues/302) * **api:** do not return empty language ([2ab3c9c](2ab3c9c)) * **webreader:** incorrect display on safari and firefox ([22b0b7e](22b0b7e)), closes [gotson#262](https://github.com/tahngarth/komga/issues/262) * **webreader:** webtoon reader not loading images ([1a030b4](1a030b4)), closes [gotson#259](https://github.com/tahngarth/komga/issues/259) * **webui:** change grid size for sm screens ([18280be](18280be)) * **webui:** clear selection after action performed ([e0cff70](e0cff70)), closes [gotson#303](https://github.com/tahngarth/komga/issues/303) * **webui:** compute scrollability on mount, fix right chevron when using display scaling ([8928959](8928959)) * **webui:** contextual filters ([f515819](f515819)), closes [gotson#290](https://github.com/tahngarth/komga/issues/290) * **webui:** correct label in library edit dialog ([c532e50](c532e50)) * **webui:** disable filter panels with no values ([57cc6c4](57cc6c4)) * **webui:** edit series dialog could incorrectly display MIXED placeholder ([5d3f061](5d3f061)) * **webui:** field should not display if empty ([968e297](968e297)) * **webui:** filter values could be duplicated ([e91954f](e91954f)) * **webui:** restore library filter for language and age rating ([dc064f2](dc064f2)) * **webui:** theme is not restored properly ([432dc91](432dc91)), closes [gotson#304](https://github.com/tahngarth/komga/issues/304) * database migration could fail ([1c9f3d0](1c9f3d0)) * database migration failure ([2ca6077](2ca6077)) * **analysis:** page number was not persisted ([99f800c](99f800c)), closes [gotson#189](https://github.com/tahngarth/komga/issues/189) * **api:** add count of in progress books in SeriesDto ([0d2713a](0d2713a)), closes [gotson#25](https://github.com/tahngarth/komga/issues/25) * **api:** add missing sort fields for Books ([797535d](797535d)) * **api:** books could disappear for users if read by others ([3d1f0e0](3d1f0e0)) * **api:** collection without element would return incorrect dto ([0891981](0891981)) * **api:** incorrect number of books per series ([bf2d0ba](bf2d0ba)) * **api:** incorrect number of books returned ([544c873](544c873)), closes [gotson#177](https://github.com/tahngarth/komga/issues/177) * **api:** pagination for collection's series ([6dd0704](6dd0704)) * **api:** sort libraries case insensitive ([1650aec](1650aec)) * **docker:** docker image doesn't start ([8bce80b](8bce80b)) * **metadata:** recognize ComicInfo Day tag and "MA15+" rating ([3ad438d](3ad438d)) * **opds:** prepend position for series in ordered collection ([7e5a141](7e5a141)) * **webreader:** cycle image fit would not persist setting ([e5272d2](e5272d2)) * **webui:** missing settings icon in webreader ([9693829](9693829)) * fix database migration errors ([f84ba17](f84ba17)), closes [gotson#239](https://github.com/tahngarth/komga/issues/239) [gotson#238](https://github.com/tahngarth/komga/issues/238) [gotson#237](https://github.com/tahngarth/komga/issues/237) [gotson#240](https://github.com/tahngarth/komga/issues/240) * ignore blank metadata fields ([c8c5df2](c8c5df2)), closes [gotson#288](https://github.com/tahngarth/komga/issues/288) * incorrect book number after adding book in series ([3b1eb36](3b1eb36)), closes [gotson#269](https://github.com/tahngarth/komga/issues/269) * incorrect read progress for books ([107d7db](107d7db)), closes [gotson#286](https://github.com/tahngarth/komga/issues/286) * potential incorrect read progress for series ([7b90244](7b90244)) * series genre is not imported from metadata ([58fac36](58fac36)) * series genre is not imported from metadata ([d0815dd](d0815dd)) * **api:** exception on unpaged empty content ([2cc27f2](2cc27f2)) * **scanner:** add TRACE logs for file update times ([5433567](5433567)), closes [gotson#159](https://github.com/tahngarth/komga/issues/159) * **webui:** action menu not showing for non-admin ([e60666c](e60666c)) * **webui:** adjust padding for grids ([02e9168](02e9168)) * **webui:** adjust series unread count when marking books ([31e21fe](31e21fe)) * **webui:** browse collection should show all series ([8629ea9](8629ea9)), closes [gotson#226](https://github.com/tahngarth/komga/issues/226) * **webui:** clear selection when reloading search results ([7d808c5](7d808c5)) * **webui:** display collection after adding in series browsing screen ([8ce5a39](8ce5a39)) * **webui:** drag series by handle when editing collection ([e72f4ab](e72f4ab)), closes [gotson#214](https://github.com/tahngarth/komga/issues/214) * **webui:** filter status not reset properly when changing library ([fea5431](fea5431)) * **webui:** incorrect count of collections in browse collections screen ([2254929](2254929)) * **webui:** lazy http call for CollectionEditDialog ([4716a1b](4716a1b)) * **webui:** lazy load collections on browse series ([d89533d](d89533d)) * **webui:** library navigation not highlighted correctly ([e28c070](e28c070)) * **webui:** make card title as link ([d6e4b80](d6e4b80)), closes [gotson#224](https://github.com/tahngarth/komga/issues/224) * **webui:** missing settings icon in sidebar ([b9e4bea](b9e4bea)) * **webui:** prevent cropping on book thumbnails ([e038857](e038857)), closes [gotson#191](https://github.com/tahngarth/komga/issues/191) * **webui:** read button link underline on hover ([863258d](863258d)) * **webui:** reset edit book dialog to first tab on reopen ([5760a06](5760a06)) * **webui:** thumbnails explorer navigation misaligned ([2ffed28](2ffed28)) * **webui:** update option title in library dialog ([29d9726](29d9726)) * order of pages is not loaded correctly from database ([d2288dd](d2288dd)), closes [gotson#189](https://github.com/tahngarth/komga/issues/189) * properly expand home dir in config ([5d86d3e](5d86d3e)), closes [gotson#195](https://github.com/tahngarth/komga/issues/195) [gotson#203](https://github.com/tahngarth/komga/issues/203) * some PDF pages are blurry ([9ad1cfe](9ad1cfe)), closes [gotson#260](https://github.com/tahngarth/komga/issues/260) * **webui:** replace mark as read/unread buttons with icons ([709ee1e](709ee1e)) * **webui:** series grid not expanding to full width ([2f7d2a4](2f7d2a4)) * **webui:** simplify unread filter ([bb60f10](bb60f10)) * **webui:** unread tick not showing properly on books ([0d0b998](0d0b998)) * **webui:** use pagination for browsing screens ([5867db7](5867db7)), closes [gotson#91](https://github.com/tahngarth/komga/issues/91) * **webui:** wider display for collection expansion panel ([96c95ea](96c95ea)) * strip accented characters for title sort when creating series ([6f1e36e](6f1e36e)), closes [gotson#188](https://github.com/tahngarth/komga/issues/188) ### Features * **api:** filter /series endpoint by library_id ([1603a96](1603a96)), closes [gotson#360](https://github.com/tahngarth/komga/issues/360) * append volume to series name ([2567796](2567796)), closes [gotson#343](https://github.com/tahngarth/komga/issues/343) [gotson#132](https://github.com/tahngarth/komga/issues/132) * **api:** filter collection's series ([cfa06a9](cfa06a9)) * **api:** filter referential data by library or series ([982983e](982983e)), closes [gotson#290](https://github.com/tahngarth/komga/issues/290) * **api:** get all age ratings ([be80d86](be80d86)) * **api:** get all languages ([115ad42](115ad42)) * **api:** get all publishers ([1929061](1929061)) * **api:** get referential data by collection ([d7fd296](d7fd296)) * **api:** http eTag caching for all API calls ([fe22cb5](fe22cb5)) * **api:** search books by tag ([f46f1a0](f46f1a0)) * **api:** search series by age rating ([f51d575](f51d575)) * **api:** search series by genre ([da4a0aa](da4a0aa)) * **api:** search series by language ([723d7c1](723d7c1)) * **api:** search series by publisher ([e4b0b2d](e4b0b2d)) * **api:** search series by tag ([7bd1de6](7bd1de6)) * **api:** search series' books by tag ([940d5d3](940d5d3)) * **api:** unpaged queries for books ([8f8054e](8f8054e)) * **opds:** browse series by publishers ([f3fcab4](f3fcab4)), closes [gotson#332](https://github.com/tahngarth/komga/issues/332) * **opds:** recently added books ([dd7bc9c](dd7bc9c)), closes [gotson#327](https://github.com/tahngarth/komga/issues/327) * order books by release date ([e3bb8bc](e3bb8bc)), closes [gotson#318](https://github.com/tahngarth/komga/issues/318) * **webreader:** add double page no cover layout ([5fe015e](5fe015e)), closes [gotson#103](https://github.com/tahngarth/komga/issues/103) * **webreader:** add shortcut information menu ([1885f32](1885f32)) * **webui:** add system theme option ([8f22f01](8f22f01)) * **webui:** change internals for shortcuts. add new shortcuts for settings ([b402817](b402817)), closes [gotson#172](https://github.com/tahngarth/komga/issues/172) * **webui:** dark theme ([efe2021](efe2021)), closes [gotson#179](https://github.com/tahngarth/komga/issues/179) * **webui:** filter collection content ([fc905ef](fc905ef)), closes [gotson#270](https://github.com/tahngarth/komga/issues/270) * **webui:** filter series by age rating ([01eef83](01eef83)) * handle multiple story arcs in ComicInfoProvider ([f4451bf](f4451bf)), closes [gotson#282](https://github.com/tahngarth/komga/issues/282) * **webreader:** better display of landscape images ([09984a4](09984a4)), closes [gotson#123](https://github.com/tahngarth/komga/issues/123) * **webreader:** side padding, original scaling for Webtoon ([6499788](6499788)), closes [gotson#266](https://github.com/tahngarth/komga/issues/266) [gotson#264](https://github.com/tahngarth/komga/issues/264) * **webreader:** webtoon reader, fit to screen ([44c814a](44c814a)), closes [gotson#81](https://github.com/tahngarth/komga/issues/81) [gotson#145](https://github.com/tahngarth/komga/issues/145) * **webui:** color coded chips for series status ([fb8a8c4](fb8a8c4)) * **webui:** handle new metadata fields ([5567adc](5567adc)), closes [gotson#276](https://github.com/tahngarth/komga/issues/276) * **webui:** more filter criteria ([4d22d9c](4d22d9c)), closes [gotson#283](https://github.com/tahngarth/komga/issues/283) [gotson#34](https://github.com/tahngarth/komga/issues/34) * **webui:** navigation drawer for sort/filter ([28598cb](28598cb)), closes [gotson#283](https://github.com/tahngarth/komga/issues/283) * add/rearrange metadata fields ([9e406e3](9e406e3)), closes [gotson#276](https://github.com/tahngarth/komga/issues/276) * **webui:** read lists ([27edf17](27edf17)), closes [gotson#106](https://github.com/tahngarth/komga/issues/106) * read lists ([f0c864f](f0c864f)), closes [gotson#106](https://github.com/tahngarth/komga/issues/106) * **webui:** library option to import local artwork ([cba0a2e](cba0a2e)) * **webui:** navigate to series books from book details screen ([48e92c7](48e92c7)), closes [gotson#272](https://github.com/tahngarth/komga/issues/272) * library option to import local artwork ([eefb802](eefb802)) * **webui:** scanner option per library ([fca0180](fca0180)) * change database from H2 to SQLite ([20b2b39](20b2b39)), closes [gotson#218](https://github.com/tahngarth/komga/issues/218) * custom thumbnails for series ([f5f423f](f5f423f)), closes [gotson#63](https://github.com/tahngarth/komga/issues/63) * get images dimension during media analysis ([f9d55ec](f9d55ec)), closes [gotson#123](https://github.com/tahngarth/komga/issues/123) * scanner option per library ([4da6ff9](4da6ff9)) * sidecar thumbnails for books ([d01b29f](d01b29f)) * **analysis:** handle read progress during book analysis ([1fc893e](1fc893e)) * **api:** add read_status parameter to series books ([fc5c502](fc5c502)), closes [gotson#25](https://github.com/tahngarth/komga/issues/25) * **api:** add read/unread books count in SeriesDto ([3ca50d7](3ca50d7)), closes [gotson#25](https://github.com/tahngarth/komga/issues/25) * **api:** claim status ([47dd2f6](47dd2f6)), closes [gotson#207](https://github.com/tahngarth/komga/issues/207) * **api:** collections are pageable ([449a27e](449a27e)), closes [gotson#216](https://github.com/tahngarth/komga/issues/216) * **api:** collections management ([c2f9403](c2f9403)), closes [gotson#30](https://github.com/tahngarth/komga/issues/30) * **api:** manage book read progress per user ([17c80cd](17c80cd)), closes [gotson#25](https://github.com/tahngarth/komga/issues/25) * **api:** mark all books in series as read or unread ([75b7216](75b7216)), closes [gotson#25](https://github.com/tahngarth/komga/issues/25) * **api:** metadata import settings per library ([6824212](6824212)), closes [gotson#199](https://github.com/tahngarth/komga/issues/199) * **api:** on deck books ([1b6a030](1b6a030)), closes [gotson#131](https://github.com/tahngarth/komga/issues/131) * **api:** read progress as search criteria for Series ([885c891](885c891)), closes [gotson#25](https://github.com/tahngarth/komga/issues/25) * **api:** restrict page streaming and file download with roles ([6291dab](6291dab)), closes [gotson#146](https://github.com/tahngarth/komga/issues/146) * **api:** search books by read status ([7f3c492](7f3c492)), closes [gotson#25](https://github.com/tahngarth/komga/issues/25) * **api:** search series by collection ids ([ca91af7](ca91af7)) * **opds:** browse by collection ([15f9c82](15f9c82)) * **webreader:** display reading direction on book opening ([ebf2aac](ebf2aac)) * **webreader:** mark progress while reading ([10895a3](10895a3)), closes [gotson#25](https://github.com/tahngarth/komga/issues/25) * **webui:** action menu on item cards ([37d790d](37d790d)) * **webui:** add On Deck section on dashboard ([37c935e](37c935e)), closes [gotson#131](https://github.com/tahngarth/komga/issues/131) * **webui:** add read status filter when browsing Series ([cc39ce8](cc39ce8)), closes [gotson#25](https://github.com/tahngarth/komga/issues/25) * **webui:** add simple next/previous book buttons to reader toolbar ([e428115](e428115)), closes [gotson#233](https://github.com/tahngarth/komga/issues/233) * **webui:** claim server from login screen ([d4810bd](d4810bd)), closes [gotson#207](https://github.com/tahngarth/komga/issues/207) * generate collections from ComicInfo SeriesGroup ([277cdcd](277cdcd)), closes [gotson#210](https://github.com/tahngarth/komga/issues/210) * **webui:** allow direct input of library path in add dialog ([6ece7b1](6ece7b1)), closes [gotson#88](https://github.com/tahngarth/komga/issues/88) * **webui:** better handling of library deletion ([0297210](0297210)) * **webui:** collection edition on card in browse collections ([e45389d](e45389d)) * **webui:** collection edition on card in search results ([68fe4fd](68fe4fd)) * **webui:** collections management ([2f8255a](2f8255a)), closes [gotson#30](https://github.com/tahngarth/komga/issues/30) * **webui:** display collections in search results and search box ([82aec45](82aec45)), closes [gotson#212](https://github.com/tahngarth/komga/issues/212) * **webui:** display unread count on series card ([4962f17](4962f17)), closes [gotson#25](https://github.com/tahngarth/komga/issues/25) * **webui:** enable edit on books and series cards in search screen ([32dad62](32dad62)) * **webui:** hide pagination when there is only 1 page ([675b4a1](675b4a1)) * **webui:** keep reading section in dashboard ([7984cef](7984cef)), closes [gotson#131](https://github.com/tahngarth/komga/issues/131) * **webui:** mark books as read or unread ([24c994f](24c994f)), closes [gotson#25](https://github.com/tahngarth/komga/issues/25) * **webui:** mark series as read/unread ([4d7e243](4d7e243)), closes [gotson#25](https://github.com/tahngarth/komga/issues/25) * **webui:** metadata import settings per library ([521cc42](521cc42)), closes [gotson#199](https://github.com/tahngarth/komga/issues/199) * **webui:** multi-select in dashboard page ([8e33be7](8e33be7)) * **webui:** multi-select in search results page ([c5417ac](c5417ac)), closes [gotson#213](https://github.com/tahngarth/komga/issues/213) * **webui:** pagination for collections ([50b516d](50b516d)), closes [gotson#216](https://github.com/tahngarth/komga/issues/216) * **webui:** read button on item card ([a59f263](a59f263)), closes [gotson#133](https://github.com/tahngarth/komga/issues/133) * **webui:** read progress filter for Series when browsing Libraries ([0c046a7](0c046a7)), closes [gotson#25](https://github.com/tahngarth/komga/issues/25) * **webui:** refresh browse collection screen on action menu actions ([8f2c453](8f2c453)) * **webui:** refresh dashboard on action menu actions ([b6bd735](b6bd735)) * **webui:** restrict page streaming and file download per user ([381b196](381b196)), closes [gotson#146](https://github.com/tahngarth/komga/issues/146) * **webui:** search results page ([89039a4](89039a4)), closes [gotson#29](https://github.com/tahngarth/komga/issues/29) * **webui:** sort/filter settings are persisted per library ([bf737de](bf737de)), closes [gotson#190](https://github.com/tahngarth/komga/issues/190) * automatic database backup ([bbb9f7c](bbb9f7c)), closes [gotson#138](https://github.com/tahngarth/komga/issues/138) * migrate DAO from Hibernate to jOOQ ([75e1079](75e1079)) * switch to JRE for docker image ([3206495](3206495)) ### Performance Improvements * add sql indexes ([41f3e8d](41f3e8d)) * lazy sql joins ([6eb7669](6eb7669))
Komga environment
Describe the bug
I'm not sure if it's a bug in the code or in the doc.
The API call
getBookPage
(at/api/v1/books/{bookId}/pages/{pageNumber}
) is documented to be used with the HTTP headeraccept: image/*
(as can be seen in the Swagger).But this doesn't work: the server answer with a 406.
Steps to reproduce
/api/v1/books/{bookId}/pages/{pageNumber}
Expected behavior
The page should be returned.
Actual behavior
The server answer with a 406.
Additional context
If you try
image/*
as documented: you get a 406.If you try with
*/*
, it works:We can see that the Content-Type is
image/jpeg
, but using it asaccept
also fails with a 406:The text was updated successfully, but these errors were encountered: