fix: code scanning alerts (#2750)

This commit is contained in:
Tom Moor 2021-11-08 22:46:30 -08:00 committed by GitHub
parent 87e8ef8fe6
commit 6a64dfe4b2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 8 additions and 10 deletions

View File

@ -96,7 +96,7 @@ export function searchUrl(
let route = "/search";
if (query) {
route += `/${encodeURIComponent(query.replace("%", "%25"))}`;
route += `/${encodeURIComponent(query.replace(/%/g, "%25"))}`;
}
search = search ? `?${search}` : "";

View File

@ -18,7 +18,7 @@ export default function present(
// the context contains <b> tags around search terms, we convert them here
// to the markdown format that slack expects to receive.
const text = context
? context.replace(/<\/?b>/g, "*").replace("\n", "")
? context.replace(/<\/?b>/g, "*").replace(/\n/g, "")
: document.getSummary();
return {

View File

@ -5,5 +5,7 @@ const DISALLOW_ROBOTS = `User-agent: *
Disallow: /`;
export const robotsResponse = (ctx: Context): ?string => {
if (ctx.headers.host.indexOf("getoutline.com") < 0) return DISALLOW_ROBOTS;
if (process.env.DEPLOYMENT !== "hosted") {
return DISALLOW_ROBOTS;
}
};

View File

@ -3,7 +3,7 @@ import * as React from "react";
import Frame from "./components/Frame";
import Image from "./components/Image";
const URL_REGEX = new RegExp("^https://viewer.diagrams.net/.*(title=\\w+)?");
const URL_REGEX = /^https:\/\/viewer\.diagrams\.net\/.*(title=\\w+)?/;
type Props = {|
attrs: {|

View File

@ -3,13 +3,9 @@ import * as React from "react";
import ImageZoom from "react-medium-image-zoom";
import Frame from "./components/Frame";
const IFRAME_REGEX = new RegExp(
"^https://(invis.io/.*)|(projects.invisionapp.com/share/.*)$"
);
const IFRAME_REGEX = /^https:\/\/(invis\.io\/.*)|(projects\.invisionapp\.com\/share\/.*)$/;
const IMAGE_REGEX = new RegExp(
"^https://(opal.invisionapp.com/static-signed/live-embed/.*)$"
);
const IMAGE_REGEX = /^https:\/\/(opal\.invisionapp\.com\/static-signed\/live-embed\/.*)$/;
type Props = {|
isSelected: boolean,