Skip to content

Commit

Permalink
updates
Browse files Browse the repository at this point in the history
  • Loading branch information
siilike committed Jul 19, 2023
1 parent ff22728 commit efbcedd
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ function validateCollectedRedirects(
}

const allowedToPaths = pluginContext.relativeRoutesPaths;
const toPaths = redirects.map((redirect) => redirect.to);
const toPaths = redirects.map((redirect) => redirect.to.replace(/#(.*)/, ''));
const trailingSlashConfig = pluginContext.siteConfig.trailingSlash;
// Key is the path, value is whether a valid toPath with a different trailing
// slash exists; if the key doesn't exist it means it's valid
Expand Down
4 changes: 2 additions & 2 deletions packages/docusaurus-plugin-client-redirects/src/options.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* LICENSE file in the root directory of this source tree.
*/

import {Joi, PathnameSchema} from '@docusaurus/utils-validation';
import {Joi, PathnameSchema, URISchema} from '@docusaurus/utils-validation';
import type {OptionValidationContext} from '@docusaurus/types';

export type RedirectOption = {
Expand Down Expand Up @@ -45,7 +45,7 @@ export const DEFAULT_OPTIONS: Partial<PluginOptions> = {
};

const RedirectPluginOptionValidation = Joi.object<RedirectOption>({
to: PathnameSchema.required(),
to: URISchema.required(),
from: Joi.alternatives().try(
PathnameSchema.required(),
Joi.array().items(PathnameSchema.required()),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@
* LICENSE file in the root directory of this source tree.
*/

import {Joi, PathnameSchema} from '@docusaurus/utils-validation';
import {Joi, PathnameSchema, URISchema} from '@docusaurus/utils-validation';
import type {RedirectItem} from './types';

const RedirectSchema = Joi.object<RedirectItem>({
from: PathnameSchema.required(),
to: PathnameSchema.required(),
to: URISchema.required(),
});

export function validateRedirect(redirect: RedirectItem): void {
Expand Down

0 comments on commit efbcedd

Please sign in to comment.