fix: remove repository link display on missing param errors (#4560)
* fix: remove repository link display on missing param errors * fix tests --------- Co-authored-by: Alexandr <qwerty541zxc@gmail.com>
This commit is contained in:
co-authored by
Alexandr
parent
92d6dfa226
commit
90955dca00
+5
-1
@@ -11,7 +11,10 @@ import {
|
||||
setErrorCacheHeaders,
|
||||
} from "../src/common/cache.js";
|
||||
import { guardAccess } from "../src/common/access.js";
|
||||
import { retrieveSecondaryMessage } from "../src/common/error.js";
|
||||
import {
|
||||
MissingParamError,
|
||||
retrieveSecondaryMessage,
|
||||
} from "../src/common/error.js";
|
||||
|
||||
// @ts-ignore
|
||||
export default async (req, res) => {
|
||||
@@ -102,6 +105,7 @@ export default async (req, res) => {
|
||||
bg_color,
|
||||
border_color,
|
||||
theme,
|
||||
show_repo_link: !(err instanceof MissingParamError),
|
||||
},
|
||||
}),
|
||||
);
|
||||
|
||||
+5
-1
@@ -8,7 +8,10 @@ import {
|
||||
setCacheHeaders,
|
||||
setErrorCacheHeaders,
|
||||
} from "../src/common/cache.js";
|
||||
import { retrieveSecondaryMessage } from "../src/common/error.js";
|
||||
import {
|
||||
MissingParamError,
|
||||
retrieveSecondaryMessage,
|
||||
} from "../src/common/error.js";
|
||||
import { parseArray, parseBoolean, renderError } from "../src/common/utils.js";
|
||||
import { fetchStats } from "../src/fetchers/stats.js";
|
||||
import { isLocaleAvailable } from "../src/translations.js";
|
||||
@@ -140,6 +143,7 @@ export default async (req, res) => {
|
||||
bg_color,
|
||||
border_color,
|
||||
theme,
|
||||
show_repo_link: !(err instanceof MissingParamError),
|
||||
},
|
||||
}),
|
||||
);
|
||||
|
||||
+5
-1
@@ -8,7 +8,10 @@ import {
|
||||
setCacheHeaders,
|
||||
setErrorCacheHeaders,
|
||||
} from "../src/common/cache.js";
|
||||
import { retrieveSecondaryMessage } from "../src/common/error.js";
|
||||
import {
|
||||
MissingParamError,
|
||||
retrieveSecondaryMessage,
|
||||
} from "../src/common/error.js";
|
||||
import { parseBoolean, renderError } from "../src/common/utils.js";
|
||||
import { fetchRepo } from "../src/fetchers/repo.js";
|
||||
import { isLocaleAvailable } from "../src/translations.js";
|
||||
@@ -105,6 +108,7 @@ export default async (req, res) => {
|
||||
bg_color,
|
||||
border_color,
|
||||
theme,
|
||||
show_repo_link: !(err instanceof MissingParamError),
|
||||
},
|
||||
}),
|
||||
);
|
||||
|
||||
+5
-1
@@ -8,7 +8,10 @@ import {
|
||||
setCacheHeaders,
|
||||
setErrorCacheHeaders,
|
||||
} from "../src/common/cache.js";
|
||||
import { retrieveSecondaryMessage } from "../src/common/error.js";
|
||||
import {
|
||||
MissingParamError,
|
||||
retrieveSecondaryMessage,
|
||||
} from "../src/common/error.js";
|
||||
import { parseArray, parseBoolean, renderError } from "../src/common/utils.js";
|
||||
import { fetchTopLanguages } from "../src/fetchers/top-languages.js";
|
||||
import { isLocaleAvailable } from "../src/translations.js";
|
||||
@@ -163,6 +166,7 @@ export default async (req, res) => {
|
||||
bg_color,
|
||||
border_color,
|
||||
theme,
|
||||
show_repo_link: !(err instanceof MissingParamError),
|
||||
},
|
||||
}),
|
||||
);
|
||||
|
||||
+5
-1
@@ -11,7 +11,10 @@ import {
|
||||
setErrorCacheHeaders,
|
||||
} from "../src/common/cache.js";
|
||||
import { guardAccess } from "../src/common/access.js";
|
||||
import { retrieveSecondaryMessage } from "../src/common/error.js";
|
||||
import {
|
||||
MissingParamError,
|
||||
retrieveSecondaryMessage,
|
||||
} from "../src/common/error.js";
|
||||
|
||||
// @ts-ignore
|
||||
export default async (req, res) => {
|
||||
@@ -121,6 +124,7 @@ export default async (req, res) => {
|
||||
bg_color,
|
||||
border_color,
|
||||
theme,
|
||||
show_repo_link: !(err instanceof MissingParamError),
|
||||
},
|
||||
}),
|
||||
);
|
||||
|
||||
@@ -129,6 +129,7 @@ describe("Test /api/gist", () => {
|
||||
renderError({
|
||||
message: 'Missing params "id" make sure you pass the parameters in URL',
|
||||
secondaryMessage: "/api/gist?id=GIST_ID",
|
||||
renderOptions: { show_repo_link: false },
|
||||
}),
|
||||
);
|
||||
});
|
||||
|
||||
@@ -212,6 +212,7 @@ describe("Test /api/pin", () => {
|
||||
message:
|
||||
'Missing params "username", "repo" make sure you pass the parameters in URL',
|
||||
secondaryMessage: "/api/pin?username=USERNAME&repo=REPO_NAME",
|
||||
renderOptions: { show_repo_link: false },
|
||||
}),
|
||||
);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user