2024-03-13 14:37:18 +01:00
|
|
|
/*
|
|
|
|
* SPDX-FileCopyrightText: syuilo and misskey-project
|
|
|
|
* SPDX-License-Identifier: AGPL-3.0-only
|
|
|
|
*/
|
|
|
|
|
2024-02-13 02:43:06 +01:00
|
|
|
import type { onRequestHookHandler } from 'fastify';
|
|
|
|
|
|
|
|
export const handleRequestRedirectToOmitSearch: onRequestHookHandler = (request, reply, done) => {
|
|
|
|
const index = request.url.indexOf('?');
|
|
|
|
if (~index) {
|
|
|
|
reply.redirect(301, request.url.slice(0, index));
|
|
|
|
}
|
|
|
|
done();
|
|
|
|
};
|