Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Check status and pass headers when proxy-streaming from file-store #17

Open
wants to merge 3 commits into
base: sa_patches_6.3.3
Choose a base branch
from
Open
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
18 changes: 17 additions & 1 deletion apps/meteor/app/file-upload/server/lib/FileUpload.ts
Original file line number Diff line number Diff line change
Expand Up @@ -562,7 +562,23 @@ export const FileUpload = {
) {
res.setHeader('Content-Disposition', `${forceDownload ? 'attachment' : 'inline'}; filename="${encodeURI(fileName)}"`);

request.get(fileUrl, (fileRes) => fileRes.pipe(res));
request.get(fileUrl, (fileRes) => {
let status = fileRes.statusCode;
if (status !== 200) {
res.setHeader('x-debug-status', status);
res.setHeader('x-debug-url', fileUrl);
res.setHeader('content-length', 0);
res.writeHead(404)
return;
}

let contentType = fileRes.headers['content-type'],
contentLength = fileRes.headers['content-length'];
if (contentType) { res.setHeader('content-type', contentType) };
if (contentLength) { res.setHeader('content-length', contentLength) };

fileRes.pipe(res);
});
},

generateJWTToFileUrls({ rid, userId, fileId }: { rid: string; userId: string; fileId: string }) {
Expand Down
2 changes: 1 addition & 1 deletion apps/meteor/packages/rocketchat-i18n/i18n/en.i18n.json
Original file line number Diff line number Diff line change
Expand Up @@ -5741,7 +5741,7 @@
"registration.component.login.incorrectPassword": "Incorrect password",
"registration.component.switchLanguage": "Switch to <1>en</1>",
"registration.component.resetPassword": "Reset password",
"registration.component.form.emailOrUsername": "Email or username",
"registration.component.form.emailOrUsername": "Email address",
"registration.component.form.username": "Username",
"registration.component.form.name": "Name",
"registration.component.form.nameOptional": "Name optional",
Expand Down
11 changes: 8 additions & 3 deletions packages/web-ui-registration/src/components/RegisterTitle.tsx
Original file line number Diff line number Diff line change
@@ -1,13 +1,18 @@
import { useSetting } from '@rocket.chat/ui-contexts';
import type { ReactElement } from 'react';
import { Trans } from 'react-i18next';

export const RegisterTitle = (): ReactElement | null => {
const siteName = useSetting<string>('Site_Name');
const hideTitle = useSetting<boolean>('Layout_Login_Hide_Title');

if (hideTitle) {
return null;
}
return <Trans i18nKey='registration.component.welcome'>Welcome to {siteName} workspace</Trans>;

return(

Check failure on line 11 in packages/web-ui-registration/src/components/RegisterTitle.tsx

View workflow job for this annotation

GitHub Actions / 🔎 Code Check / Code Lint

Insert `·`

Check failure on line 11 in packages/web-ui-registration/src/components/RegisterTitle.tsx

View workflow job for this annotation

GitHub Actions / 🔎 Code Check / Code Lint

Insert `·`
<>
Seeking Alpha
<br />
Investing Groups
</>
);
};
Loading