Rocket.Chat icon indicating copy to clipboard operation
Rocket.Chat copied to clipboard

Error when upload file to Rocket Chat in subfolder

Open annony-zx opened this issue 10 years ago • 28 comments

Your Rocket.Chat version: 0.28 (make sure you are running the latest)

Hi, I have some problem with Rocket Chat in subfolder

  • I can chat via web but can't access via App on Mobile
  • When I upload any file, it can't display with Image, text,.. and I can't download it too. Can you help me resolv them ?

This is error when i upload a photo. 1

annony-zx avatar Apr 29 '16 06:04 annony-zx

What are your file upload settings?

marceloschmidt avatar Apr 29 '16 18:04 marceloschmidt

I have same issue with images uploaded, please fix in next version.

My rocket.chat version: 0.29

Thank you very much!

image

dangkiena3 avatar May 04 '16 07:05 dangkiena3

Sorry @marceloschmidt , I have had a holiday recently so I can't reply to you. I don't change any setting in Rocket Chat server. It is default setting. I found it have some problem with link of file upload, it isn't behind subfolder. I think it shoud be .../chat/file-upload/

Here is my setting: 1

annony-zx avatar May 04 '16 08:05 annony-zx

This issue is file uploaded not run in sub directory like main page:

image

image

dangkiena3 avatar May 04 '16 09:05 dangkiena3

Please help me :(

dangkiena3 avatar May 09 '16 03:05 dangkiena3

@dangkiena3 using in a subdirectory is a very new addition, not many people are using it yet. So we're still working out the kinks. Bare with us

geekgonecrazy avatar May 11 '16 01:05 geekgonecrazy

@geekgonecrazy many thank for reply. I'm still wait...

dangkiena3 avatar May 11 '16 02:05 dangkiena3

Same my issue, +1

dungvu-equix avatar May 13 '16 04:05 dungvu-equix

Now version 0.31 still does not fix this issue :(

dangkiena3 avatar May 18 '16 07:05 dangkiena3

Version 0.32 still...

dangkiena3 avatar Jun 06 '16 09:06 dangkiena3

Now is 0.33 version, please help me

dangkiena3 avatar Jun 07 '16 09:06 dangkiena3

Yup, having the same problem.

SQUIDwarrior avatar Jun 17 '16 22:06 SQUIDwarrior

Is there a way I could hack this temporarily by hard-coding my subfolder somewhere?

SQUIDwarrior avatar Jun 17 '16 23:06 SQUIDwarrior

@SQUIDwarrior:

Why not temporarily "solve" the issue by creating a simple rewrite rule? It should be quite easy depending on what web server you're running.

[EDIT: Actually, forget my suggestion. It was just a thought and it could be done if you were really desperately needing it to at least momentarily work — until the issue is solved. I am fully aware that my suggestion is far from perfect or ideal.]

k0nsl avatar Jun 18 '16 00:06 k0nsl

@k0nsl - No, that's a good workaround actually. I will give that a try! I totally didn't think of using a rewrite rule

[EDIT: Nope, that doesn't seem to work either. Guess I'll have to disable file uploads until this is fixed]

SQUIDwarrior avatar Jun 18 '16 00:06 SQUIDwarrior

Still present with v0.34.

webwurst avatar Jun 25 '16 14:06 webwurst

Im taking a stab at this..

AlecTroemel avatar Jun 29 '16 16:06 AlecTroemel

@AlecTroemel awesome, all yours! 👍 Let us know how it goes. Feel free to open a PR if you need us to take a look at what you have. PR's are great for discussing in context of the code :smile:

geekgonecrazy avatar Jun 29 '16 18:06 geekgonecrazy

same problem here :cry:

9joshua avatar Jul 01 '16 02:07 9joshua

by changing https://github.com/AlecTroemel/Rocket.Chat/blob/develop/packages/rocketchat-message-attachments/client/messageAttachment.coffee#L11 to

return RocketChat.settings.get('Site_Url').replace(/\/$/, '') + url

rocketchat was able to find the image when being behind an nginx reverse proxy. However there is another (deeper) bug where it gives a 403 error on trying to get the image. this is because https://github.com/AlecTroemel/Rocket.Chat/blob/develop/lib/fileUpload.coffee#L16 is getting null for

Meteor._localStorage.getItem('Meteor.loginToken');

This value is needed to find an user and verify that they are able to see the image here https://github.com/AlecTroemel/Rocket.Chat/blob/develop/packages/rocketchat-file-upload/server/lib/requests.js#L30

This can be worked around by setting Administration --> File Upload --> Protect uploaded files to false... though anyone can go and see those images..

AlecTroemel avatar Jul 01 '16 19:07 AlecTroemel