Skip to content

Commit

Permalink
Fix silly bugs in listWarcsByCrawl
Browse files Browse the repository at this point in the history
  • Loading branch information
ato committed Aug 2, 2023
1 parent f21f800 commit f86f26c
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
6 changes: 3 additions & 3 deletions ui/src/bamboo/api/DataApiController.java
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ private void enforceAgwaCrawl(Crawl crawl) throws AccessDeniedException {
@GetMapping(value = "/data/crawls/{crawlId}/warcs", produces = MediaType.APPLICATION_JSON_VALUE)
@ResponseBody
public ArrayList<WarcData> listWarcsByCrawl(@PathVariable long crawlId,
@RequestParam(value = "page", defaultValue = "0") int page,
@RequestParam(value = "page", defaultValue = "1") int page,
@RequestParam(value = "pageSize", defaultValue = "10000") int pageSize,
HttpServletRequest request,
UriComponentsBuilder uriBuilder) throws AccessDeniedException, MissingCredentialsException {
Expand All @@ -115,8 +115,8 @@ public ArrayList<WarcData> listWarcsByCrawl(@PathVariable long crawlId,
var pager = wa.warcs.paginateWithCrawlId(page, crawlId, pageSize);
var list = new ArrayList<WarcData>();
for (var warc : pager.items) {
String url = uriBuilder.path("/data/warcs").pathSegment(Long.toString(warc.getId())).toUriString();
String textUrl = uriBuilder.path("/data/text").pathSegment(Long.toString(warc.getId())).toUriString();
String url = uriBuilder.cloneBuilder().path("/data/warcs").pathSegment(Long.toString(warc.getId())).toUriString();
String textUrl = uriBuilder.cloneBuilder().path("/data/text").pathSegment(Long.toString(warc.getId())).toUriString();
list.add(new WarcData(url, textUrl, warc));
}
return list;
Expand Down
2 changes: 1 addition & 1 deletion ui/src/bamboo/crawl/Warcs.java
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ public List<Warc> findByCrawlId(long crawlId) {
}

public Pager<Warc> paginateWithCrawlId(long page, long crawlId, long pageSize) {
return new Pager<>(page, dao.countWarcsWithCrawlId(crawlId),
return new Pager<>(page, pageSize, dao.countWarcsWithCrawlId(crawlId),
(limit, offset) -> dao.paginateWarcsInCrawl(crawlId, limit, offset));
}

Expand Down
2 changes: 1 addition & 1 deletion ui/src/bamboo/util/Pager.java
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ public class Pager<T> {
public final List<T> items;

public Pager(long page, long totalItems, PaginationQuery<T> query) {
this(page, totalItems, 100, query);
this(page, 100, totalItems, query);
}

public Pager(long page, long pageSize, long totalItems, PaginationQuery<T> query) {
Expand Down

0 comments on commit f86f26c

Please sign in to comment.