mirror of
https://github.com/qaiu/netdisk-fast-download.git
synced 2026-11-25 06:47:00 +00:00
api: accept pg as an alias of page for folder listing
Co-authored-by: qaiu <[email protected]>
This commit is contained in:
3 files changed
+8
-6
No files matched your search
@@ -72,7 +72,8 @@ public class URLParamUtil {
|
||||
if (!paramName.equals("url") && !paramName.equals("pwd") && !paramName.equals("dirId")
|
||||
&& !paramName.equals("uuid") && !paramName.equals("auth")
|
||||
&& !paramName.equals("stoken") && !paramName.equals("zml")
|
||||
&& !paramName.equals("page") && !paramName.equals("pageCursor")) {
|
||||
&& !paramName.equals("page") && !paramName.equals("pg")
|
||||
&& !paramName.equals("pageCursor")) {
|
||||
if (firstParam) {
|
||||
urlBuilder.append("?");
|
||||
firstParam = false;
|
||||
|
||||
@@ -165,16 +165,16 @@ public class ParserApi {
|
||||
}
|
||||
|
||||
/**
|
||||
* 目录列表。不带 page 时行为与旧版一致;带 page 时返回该页(结构不变)。
|
||||
* 目录列表。不带 page 时行为与旧版一致;带 page 时返回该页(结构不变)。pg 是 page 的别名。
|
||||
* 需要 hasMore / nextCursor 时用 {@link #getFileListPage}。
|
||||
*/
|
||||
@RouteMapping("/getFileList")
|
||||
public Future<List<FileInfo>> getFileList(HttpServerRequest request, String pwd, String dirId, String uuid,
|
||||
String stoken, String zml, String auth,
|
||||
String page, String pageCursor) {
|
||||
String page, String pg, String pageCursor) {
|
||||
Integer pageNo;
|
||||
try {
|
||||
pageNo = FolderPaging.parsePage(page);
|
||||
pageNo = FolderPaging.parsePage(StringUtils.isNotBlank(page) ? page : pg);
|
||||
} catch (IllegalArgumentException e) {
|
||||
return Future.failedFuture(e.getMessage());
|
||||
}
|
||||
@@ -188,10 +188,10 @@ public class ParserApi {
|
||||
@RouteMapping("/getFileListPage")
|
||||
public Future<FileListPageResp> getFileListPage(HttpServerRequest request, String pwd, String dirId, String uuid,
|
||||
String stoken, String zml, String auth,
|
||||
String page, String pageCursor) {
|
||||
String page, String pg, String pageCursor) {
|
||||
int pageNo;
|
||||
try {
|
||||
Integer parsed = FolderPaging.parsePage(page);
|
||||
Integer parsed = FolderPaging.parsePage(StringUtils.isNotBlank(page) ? page : pg);
|
||||
pageNo = parsed == null ? 1 : parsed;
|
||||
} catch (IllegalArgumentException e) {
|
||||
return Future.failedFuture(e.getMessage());
|
||||
|
||||
@@ -17,6 +17,7 @@ public class URLParamUtilPagingTest {
|
||||
.add("url", "https://pan.lanzoui.com/b66477")
|
||||
.add("pwd", "1234")
|
||||
.add("page", "2")
|
||||
.add("pg", "2")
|
||||
.add("pageCursor", "eyJ2IjoxfQ");
|
||||
assertEquals("https://pan.lanzoui.com/b66477", URLParamUtil.parserParams(request(params)));
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user