Showing results for 
Search instead for 
Did you mean: 

File preview showing incorrect file contents

Jump to solution

I'm having an issue with the file preview feature of Canvas not showing the correct contents of text files.

Here's an example:

On a Canvas Page, I have linked several text files (which I have uploaded to the Canvas Files area):


If I now click on the file preview for world2.txt, I see:


Similarly, if I click on the world2.txt link, I see:


However, when I download the file and open it up, I get:


The downloaded version is correct (compared to what I uploaded to Canvas Files).

There are two issues with the preview versions:

1) The preview is adding a period (.) after some of the numbers which are not present in the existing text file. This is annoying, but the purposes of what I am doing in my course, ok (since 4 and 4. represent the same number in the program my students are using)

2) The preview versions are missing some lines and show a line that is not in the file!!! Specifically, the preview has

4. 4

5. 6  <--- line not in the actual file!

6. 4

while the actual file contains

4 4

4 5 <--- missing from preview!

5 6 <--- missing from preview!

6 4

This is a much more serious problem. What's going on? How can I make Canvas' preview show the actual contents of my text files?

22 Replies

I teach computer science to university students. Asking students to copy-paste a gigantic data file from a page I have to create in Canvas is unreasonable. These are data files they are feeding into their programs, so they need to be able to be downloaded. (And, as a computer scientist, I find it incredible that Canvas' file preview cannot preview a simple plain-text file ending in a .txt extension correctly. Seriously?!? Just display the exact characters as they are in the file. It's PLAIN-TEXT.)

I thought the point of having an LMS is that there would be ONE place I could send my students to for info related to the course. The more I deal with Canvas, the more it seems there are significant problems with it that Canvas has no interest/ability to fix so that there is this increasing difficult-to-find knowledge base of hacks to Canvas that pull in aspects of Google Docs and other reasonable management systems that require esoteric skills (and the time to learn them).

I'd much rather have a File Preview that worked correctly than be able to change the colors on my Dashboard, but apparently Canvas thinks that's a much more critical thing to address than an actual bug in their code.

Community Member


As best as I can tell, the Canvas document viewer is "trying" to be helpful and failing miserably. It looks like it's assuming that you are doing some sort of sequential line numbering and "fixing" your sequence for you. Definitely a bug.

If the help desk is unable to assist, request that they escalate the case to Instructure Canvas Support. If necessary, request to speak with whoever manages the help desk, their boss, or the CIO (Office of the CIO - UW-Madison Information Technology) as a last resort.




The help desk was able to replicate this and escalated it to Canvas. The Canvas engineers acknowledge it's a bug. I have been given no info about any time frame for fixing this or for any workarounds in the meantime (such as disabling file preview ability for data files I want my students to download and use in  their programs so they do not have access to the Canvas-corrupted file display).


Hi Beck--

I don't know if you mentioned disabling inline file previews because you already found it on your own, or because you were throwing it out there as a possible workaround that should be available. If it's the latter, this may help: here's how you disable inline file previews

For kicks, I tried recreating the file example, above, and encoding the file in a number of different plain text formats. I got the same result you did for all of them. 

The issue with this rendering in SpeedGrader is good to know, and I probably wouldn't have thought of it, but it's consistent, since it's the same document previewer in all locations in Canvas--it's only that markup tools are available in some places, but not in others. . 


Thanks for the link,‌. Only one small problem - the student can still click on the link and it opens up in a separate page (within Canvas) and shows the corrupted File Preview Smiley Sad


Ach. Yes. It used to behave differently and send students to a direct download of the file. Possibly prior to the DocViewer implementation. 

The only viable workaround would be to tell them to download it in the instructions. OR link to a shared Google Drive file upload, which doesn't result in the same problem. It creates the additional problem of needing to manage course content in multiple locations, though, which may or may not be a drag, depending on how you like to manage things. 


Heads up - this bug is also present in the Speedgrader. So that means if you (or your TAs) ever graded text files turned in by students by looking at them in the Speedgrader, you should know that you may not have been viewing the actual contents of the files turned in by the students.


(Non)Update: This bug is still in there (and has caused problems in the completely on-line Canvas class I am teaching this summer). It affects the file preview of text files ANYWHERE they show up, including on content pages (which is where I am having the main issue this summer - the students literally can't see the correct output text file their code should produce).

0 Kudos
Community Member

I am seeing this exact same behavior.    This really needs to be fixed, as it is showing students completely incorrect file contents!  I am shocked this was reported above almost a year ago and this hasn't been addressed.  


I completely agree -- my students are asking me about what they are seeing in Canvas (because it's not the contents of the file I did upload to Canvas). The fact that Canvas can't (or won't) even get the preview of a simple PLAIN TEXT FILE correct AND won't make any attempt to fix it over the course of nearly a year shows just how much they actually care about customer feedback about BUGS in their product, IMO.

0 Kudos
Top Kudoed Authors