- ShiftSupervisorAsked on January 13, 2015 at 10:52 PM
I'm trying to download all of my form file submissions and I decided to try the file downloader app that was recommended elsewhere on the forum. (Dropbox integration wasn't set up before the submissions and I would leave the PDF downloader as the last resort) However, when I installed Ruby and tried executing the script, I receive the following syntax error:
downloadUploadedFiles.rb:5: syntax error, unexpected '<'
downloadUploadedFiles.rb:6: syntax error, unexpected '<'
downloadUploadedFiles.rb:6: syntax error, unexpected keyword_class, expecting $end
For further reference, I tried both Ruby 2.1.5 and Ruby 1.9.3 with the same results. Even attempting to execute the file downloader without the API key or the form ID results in this error. I tried searching around the forums for an answer but it seems that only one other person had this error and that person never found a solution.
Can anyone help me with this issue? Thanks for your time!
- JotForm Supportashwin_dAnswered on January 14, 2015 at 03:40 AM
I'm sorry for the trouble caused to you. It is strange that you are getting syntax error.
I just installed ruby "Ruby 1.9.3-p551" and also downloaded the ".rb" filed from GitHub. When I tested it with one of my own form, I did not get any syntax error.
Though I was also not able to download the files as it seems to related to SSL issue but I did not see any syntax error. Please check the screenshot below:
In most likely case you must have not downloaded the ".rb" files correctly. Please click on the following URL to download these files:
I am also reporting the SSL connect issue to our back end team. We will get back to you as soon as we have any update from them.
- JotForm SupportliyamAnswered on January 17, 2015 at 06:23 AM
Can you share with us the code on those lines? From the looks of it, it seems that the word 'end' was cut off or something like it, so you might have copied a code in error. If you have copy-pasted the source, I recommend viewing it in raw, press ctrl+a, to select all, then copy.
Please do keep us posted on this matter.
- ShiftSupervisorAnswered on June 24, 2015 at 01:29 PM
I apologize for the delay in replying but I tried the downloader again. I was able to successfully run the code (I probably copied it wrong the first time) but I am still receiving the SSL errors that ashwin_d mentioned earlier. Has there been any update regarding this?
Thank you and sorry for the delay!
- BorisAnswered on June 24, 2015 at 02:59 PM
Thank you for letting us know.
We do not have any update as of this time regarding the SSL errors, but our assigned developer will take a look into it, and we will let you know if/when we have any update regarding this.
Thank you for your patience.
- ShiftSupervisorAnswered on June 25, 2015 at 11:11 AM
I did some additional digging and I found that Ruby for windows has a specific error in verifying ssl certifications. It seems to be an issue found in Ruby itself. I tried a solution that I found online but it didn't work for me:
My solution involved downloading virtualbox and installing ubuntu so that I could use Ruby on linux, which doesn't seem to have this issue. There may be a more elegant solution to this but I'm not too familiar with Ruby. I was able to download the files successfully so this works for me.
I hope this information helps the developers figure out this issue. Thank you for your help!
- BorisAnswered on June 25, 2015 at 12:00 PM
Thank you very much for your detailed explanation and further investigation into the issue. I have edited the original bug to include your findings, and I'm sure that this information will be of help to our developers.
If it is indeed due to a bug in Ruby itself on Windows, I'm not sure if there will be anything we could do to fix it on our end, but we will let you know if we do.
Again, thank you.
- JotForm SupportliyamAnswered on June 25, 2015 at 02:39 PM
Thank you for keeping us posted, ShiftSupervisor.
I also have made some research specifically on this matter a couple of months back. If I remember it right, the problem was with how the Ruby for Windows was compiled. It was looking for a certain directory for the certificates. However, I didn't bother creating such directory since it was looking for a user directory on windows which I believe it's too much the effort for creating a new account on your Windows PC just to have the problem resolved.
Fortunately, there's a way to bypass the verification, but please, this is not a recommended solution, nor a solution that I'd be proud to give to anyone. But to just get things by and have the files downloaded, here it is:
Edit downloadUploadedFiles.rb and add this on line 8:
OpenSSL::SSL::VERIFY_PEER = OpenSSL::SSL::VERIFY_NONE
Next, save the file and run again on command prompt. It should return a warning downloadUploadedFiles.rb:8: warning: already initialized constant VERIFY_PEER but that should be alright.
Please let us know if the problem persists.
- ShiftSupervisorAnswered on June 25, 2015 at 10:11 PM
This also worked perfectly with another form of mine!
Thank you very much!
- JotForm Supportashwin_dAnswered on June 26, 2015 at 12:06 AM
On behalf of my colleague, you are welcome.
I am glad to know that my colleague's workaround solved your problem.
Do get back to us if you have any questions.