AnsweredAssumed Answered

File Download URL Problem

Question asked by Christopher Poole on Jun 20, 2018

Hello Canvas Developers,

 

We're trying to see the contents of a text file within a course's file structure. We're doing this by first finding the file's JSON object using GET /api/v1/courses/course_id/files?search_term=filename.txt and then take the URL parameter from that JSON object and sending a GET request to it. This only returns the message "Cannot connect to destination host". We've printed the URL to output as well and tried to access it through our browsers and in doing so found two problems:

 

1. We've set up our Canvas instance on a virtual machine which is using IPv6. The URL it gives us doesn't like that at all and gives us [FE80:0000:0000:0000:0A00:27FF:FEFE:70C5] instead of just [fe80:a00:27ff:fefe:70c5]. This isn't too bad of a problem considering we will have a way to change our IP soon and obviously no real Canvas instances are going to be set up with purely IPv6 addresses.

 

2. We receive "\u0026" instead of "&" right before the verifier code, much like what's happening to DJ Rao in his question Is there an API to download contents (not metadata) of a file from a given assignment?  

 

Whenever we manually try to fix both of these problems in the browser, it automatically changes the IP to my local IPv4 address and spits out a familiar message about it not being able to connect. In a few days we'll be able to try using an IPv4 address but right now I'm wondering if there is anything inherently wrong with the way we're approaching this. Is this the optimal way to look at the contents of a file?

Outcomes