appirio-tech / lc1-project

Core challenge engine for Serenity Project
MIT License
6 stars 8 forks source link

Challenge file download not working #476

Closed gaitonde closed 9 years ago

gaitonde commented 9 years ago
  1. Goto a challenge, eg - http://tcqa1.topcoder.com/challenge-details/89/?type=develop&lc=true
  2. Click on a challenge download. eg. 'attachment' on challenge 89 - http://tcqa1.topcoder.com/challenge-details/89/undefined
indytechcook commented 9 years ago

This is most likely related to #478

indytechcook commented 9 years ago

Crazy url being called: http://monosnap.com/image/RHCIhrvuAOEjEg9XN9itn1sJAHLiXd

http://qa-lc1-ext-challenge-service.herokuapp.com/challenges/89/files/59?0=d&1=o&2=w&3=n&4=l&5=o&6=a&7=d&indexOfRegExp=function+(pattern,modifiers)%7Bvar+re%3Dnew+RegExp(pattern,modifiers),m%3Dre.exec(this.valueOf())%3Breturn+null%3D%3Dm%3F-1:m.index%7D

indytechcook commented 9 years ago

It appears as restangular is building the url incorrectly. Not sure why this is QA only. Might be related to minification of javascript.

gaitonde commented 9 years ago

It looks like an encoding issue. The value has "download" in it w/ the "indexOf" method being called.

Crazy url ain't that crazy :)

indytechcook commented 9 years ago

Yeah, I saw that, just trying to figure out why I hadn't seen that before

indytechcook commented 9 years ago

This is now fixed in Dev. We still have the issue with the URl itself not working but this issue if fixed.

gaitonde commented 9 years ago

@indytechcook - this means that URI is to the right location, but we are getting AccessDenied, correct?

indytechcook commented 9 years ago

correct.

On Tue, Dec 16, 2014 at 1:08 PM, Dayal Gaitonde notifications@github.com wrote:

@indytechcook https://github.com/indytechcook - this means that URI is to the right location, but we are getting AccessDenied, correct?

— Reply to this email directly or view it on GitHub https://github.com/appirio-tech/lc1-project/issues/476#issuecomment-67203954 .

gaitonde commented 9 years ago

I know you have some fixes in mind, but just thought I'd share something I found on SO about setting the region -

AWS.config.region = 'us-west-2';

Ref: http://stackoverflow.com/questions/24095977/fetching-signed-url-from-aws-s3-on-my-node-server

indytechcook commented 9 years ago

Thanks. That makes sense.

On Tue, Dec 16, 2014 at 1:26 PM, Dayal Gaitonde notifications@github.com wrote:

I know you have some fixes in mind, but just thought I'd share something I found on SO about setting the region -

AWS.config.region = 'us-west-2';

Ref: http://stackoverflow.com/questions/24095977/fetching-signed-url-from-aws-s3-on-my-node-server

— Reply to this email directly or view it on GitHub https://github.com/appirio-tech/lc1-project/issues/476#issuecomment-67206864 .

indytechcook commented 9 years ago

I have it working for challenge files locally. Pushing code now.

Can you update the file upload to not set the base '/' in the fileUrl.

On Tue, Dec 16, 2014 at 1:34 PM, Neil Hastings nhastings@appirio.com wrote:

Thanks. That makes sense.

On Tue, Dec 16, 2014 at 1:26 PM, Dayal Gaitonde notifications@github.com wrote:

I know you have some fixes in mind, but just thought I'd share something I found on SO about setting the region -

AWS.config.region = 'us-west-2';

Ref: http://stackoverflow.com/questions/24095977/fetching-signed-url-from-aws-s3-on-my-node-server

— Reply to this email directly or view it on GitHub https://github.com/appirio-tech/lc1-project/issues/476#issuecomment-67206864 .

indytechcook commented 9 years ago

wait, are we uploading to west?

gaitonde commented 9 years ago

Sorry just to be super clear you want me to remove the leading slash, correct? -

challenges/{challengeId}/...

instead of

/challenges/{challengeId}/...
indytechcook commented 9 years ago

Per removing the slash, Yes

gaitonde commented 9 years ago

It's odd - s3 doesn't really have a "region", but there are places in code that it's req'd.

I would think as long as it's consistent it's ok. That said, it's probably best to use east -

AWS.config.region = 'us-east-1';

indytechcook commented 9 years ago

I set the challenge service to look at the config

indytechcook commented 9 years ago

Thanks, I wanted to verify we were changing the designed functionality.