[FIX] Broken download link on uploaded files (#22848)

* switched from rtrim to replace

* removed subdirectory start

* added regex to string.replace

* added regex to string.replace

* proper user of scape regex

* removed logging statement
pull/22856/head^2
Leonardo Ostjen Couto 4 years ago committed by GitHub
parent 89ee544824
commit 5dc6eafecc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 3
      app/utils/lib/getURL.js

@ -1,4 +1,5 @@
import s from 'underscore.string';
import { escapeRegExp } from '@rocket.chat/string-helpers';
import { isURL } from './isURL';
import { settings } from '../../settings';
@ -54,7 +55,7 @@ export const _getURL = (path, { cdn, full, cloud, cloud_route, cloud_params, _cd
}
if (full) {
return s.rtrim(siteUrl, pathPrefix) + url;
return siteUrl.replace(new RegExp(`${ escapeRegExp(pathPrefix) }$`), '') + url;
}
return url;

Loading…
Cancel
Save