Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion app/autotranslate/server/autotranslate.js
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ export class AutoTranslate {
message = Markdown.parseMessageNotEscaped(message);

// Some parsers (e. g. Marked) wrap the complete message in a <p> - this is unnecessary and should be ignored with respect to translations
const regexWrappedParagraph = new RegExp('^\s*<p>|<\/p>\s*$', 'gm');
const regexWrappedParagraph = new RegExp('^\\s*<p>|</p>\\s*$', 'gm');
message.msg = message.msg.replace(regexWrappedParagraph, '');

for (const tokenIndex in message.tokens) {
Expand Down
2 changes: 1 addition & 1 deletion app/file-upload/server/lib/FileUpload.js
Original file line number Diff line number Diff line change
Expand Up @@ -318,7 +318,7 @@ export const FileUpload = {
// This file type can be pretty much anything, so it's better if we don't mess with the file extension
if (file.type !== 'application/octet-stream') {
const ext = mime.extension(file.type);
if (ext && new RegExp(`\.${ ext }$`, 'i').test(file.name) === false) {
if (ext && new RegExp(`\\.${ ext }$`, 'i').test(file.name) === false) {
file.name = `${ file.name }.${ ext }`;
}
}
Expand Down
2 changes: 1 addition & 1 deletion app/file-upload/server/lib/proxy.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ WebApp.connectHandlers.stack.unshift({
const path = parsedUrl.pathname.substr(UploadFS.config.storesPath.length + 1);

// Get store
const regExp = new RegExp('^\/([^\/\?]+)\/([^\/\?]+)$');
const regExp = new RegExp('^/([^/?]+)/([^/?]+)$');
const match = regExp.exec(path);

// Request is not valid
Expand Down
2 changes: 1 addition & 1 deletion app/highlight-words/client/helper.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ const highlightTemplate = '$1<span class="highlight-text">$2</span>$3';

export const getRegexHighlight = (highlight) => new RegExp(`(^|\\b|[\\s\\n\\r\\t.,،'\\\"\\+!?:-])(${ s.escapeRegExp(highlight) })($|\\b|[\\s\\n\\r\\t.,،'\\\"\\+!?:-])(?![^<]*>|[^<>]*<\\/)`, 'gmi');

export const getRegexHighlightUrl = (highlight) => new RegExp(`https?:\/\/(www\.)?[-a-zA-Z0-9@:%._\\+~#=]{2,256}\.[a-z]{2,6}\\b([-a-zA-Z0-9@:%_\\+.~#?&//=]*)(${ s.escapeRegExp(highlight) })\\b([-a-zA-Z0-9@:%_\\+.~#?&//=]*)`, 'gmi');
export const getRegexHighlightUrl = (highlight) => new RegExp(`https?:\/\/(www\\.)?[-a-zA-Z0-9@:%._\\+~#=]{2,256}\\.[a-z]{2,6}\\b([-a-zA-Z0-9@:%_\\+.~#?&//=]*)(${ s.escapeRegExp(highlight) })\\b([-a-zA-Z0-9@:%_\\+.~#?&//=]*)`, 'gmi');

export const highlightWords = (msg, highlights) => highlights.reduce((msg, { highlight, regex, urlRegex }) => {
const urlMatches = checkHighlightedWordsInUrls(msg, urlRegex);
Expand Down
12 changes: 6 additions & 6 deletions app/oembed/server/providers.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,32 +39,32 @@ class Providers {
const providers = new Providers();

providers.registerProvider({
urls: [new RegExp('https?://soundcloud.com/\\S+')],
urls: [new RegExp('https?://soundcloud\\.com/\\S+')],
endPoint: 'https://soundcloud.com/oembed?format=json&maxheight=150',
});

providers.registerProvider({
urls: [new RegExp('https?://vimeo.com/[^/]+'), new RegExp('https?://vimeo.com/channels/[^/]+/[^/]+'), new RegExp('https://vimeo.com/groups/[^/]+/videos/[^/]+')],
urls: [new RegExp('https?://vimeo\\.com/[^/]+'), new RegExp('https?://vimeo\\.com/channels/[^/]+/[^/]+'), new RegExp('https://vimeo\\.com/groups/[^/]+/videos/[^/]+')],
endPoint: 'https://vimeo.com/api/oembed.json?maxheight=200',
});

providers.registerProvider({
urls: [new RegExp('https?://www.youtube.com/\\S+'), new RegExp('https?://youtu.be/\\S+')],
urls: [new RegExp('https?://www\\.youtube\\.com/\\S+'), new RegExp('https?://youtu\\.be/\\S+')],
endPoint: 'https://www.youtube.com/oembed?maxheight=200',
});

providers.registerProvider({
urls: [new RegExp('https?://www.rdio.com/\\S+'), new RegExp('https?://rd.io/\\S+')],
urls: [new RegExp('https?://www\\.rdio\\.com/\\S+'), new RegExp('https?://rd\\.io/\\S+')],
endPoint: 'https://www.rdio.com/api/oembed/?format=json&maxheight=150',
});

providers.registerProvider({
urls: [new RegExp('https?://www.slideshare.net/[^/]+/[^/]+')],
urls: [new RegExp('https?://www\\.slideshare\\.net/[^/]+/[^/]+')],
endPoint: 'https://www.slideshare.net/api/oembed/2?format=json&maxheight=200',
});

providers.registerProvider({
urls: [new RegExp('https?://www.dailymotion.com/video/\\S+')],
urls: [new RegExp('https?://www\\.dailymotion\\.com/video/\\S+')],
endPoint: 'https://www.dailymotion.com/services/oembed?maxheight=200',
});

Expand Down
4 changes: 2 additions & 2 deletions app/ui-message/client/messageBox/messageBoxAutogrow.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,9 @@ export const setupAutogrow = (textarea: HTMLTextAreaElement, shadow: HTMLDivElem
return true;
}

const shadowText = text.replace(/</g, '&lt;')
const shadowText = text.replace(/&/g, '&amp;')
.replace(/</g, '&lt;')
.replace(/>/g, '&gt;')
.replace(/&/g, '&amp;')
.replace(/\n$/, '<br/>&nbsp;')
.replace(/\n/g, '<br/>')
.replace(/ {2,}/g, replaceWhitespaces);
Expand Down