because the zip central directory can lie
test plan:
1. Create a huge file (say a gigabyte) where every byte is the
same.
2. Zip it. The repeating data will be compressed. The ZIP will
be tiny but will uncompress to a huge file.
3. Edit the zip file binary. Open it with a hex editor and
change the file size in the directory. Make the file
appear to be small enough to fit into the course quota.
(The zip file format is documented at
http://www.pkware.com/documents/casestudies/APPNOTE.TXT
or ask the committer for help)
4. Try to import the zip file into a course (migrations/
import zip file into folder)
5. You should receive a quota error.
fixes CNVS-10722
Change-Id: Ib1bd1c432ef900f0c6c61ebe6eab2881f8515104
Reviewed-on: https://gerrit.instructure.com/29704
Reviewed-by: Mark Severson <markse@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
QA-Review: Nathan Rogowski <nathan@instructure.com>
Product-Review: Jeremy Stanley <jeremy@instructure.com>
test plan: zip functionality should continue to work, including:
* course exports and imports
* zip file uploads
* zip submissions
also, the selenium dependency on rubyzip 1.0.0 is resolved
and we're making progress toward > 4GB exports
Change-Id: I58c5b0644b1e7fbb289821c9c0901f00750988de
Reviewed-on: https://gerrit.instructure.com/25474
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Bryan Madsen <bryan@instructure.com>
Product-Review: Bryan Madsen <bryan@instructure.com>
QA-Review: Matt Fairbourn <mfairbourn@instructure.com>
now that we have SIGHUP, we were changing everything to it anyway,
so just let caching in-proc be the default
Change-Id: Id1b44722522ac9693b17695da7107c99a359d5ac
Reviewed-on: https://gerrit.instructure.com/25020
Reviewed-by: Cody Cutrer <cody@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
test plan:
* ensure scribd documents are rendered automatically
when uploading single files to a course
* ensure scribd documents are not rendered automatically
when uploading a zip file full of documents to a course
* ensure scribd documents are not rendered automatically
when files are imported with a content migration package
* ensure scribd documents that were not rendered
automatically will be rendered on demand
(i.e., the first time they'll view with google docs
if available, or a "processing, try again" message
otherwise; later page loads should view the
document in scribd once it's done rendering)
fixes #CNVS-8078
Change-Id: Ibe821783e45dfa32b9bfdeb23b125237b45e9890
Reviewed-on: https://gerrit.instructure.com/24404
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Jeremy Stanley <jeremy@instructure.com>
QA-Review: Hannah Bottalla <hannah@instructure.com>
Product-Review: Bracken Mosbacker <bracken@instructure.com>
fixes CNVS-6947
test plan:
* upload a file whose name begins with ~
* download a zip of the folder the file is in
* it should work
Change-Id: I828095b2dffe96805df5dc4921cfdce7c38af287
Reviewed-on: https://gerrit.instructure.com/22414
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Brian Palmer <brianp@instructure.com>
QA-Review: Jeremy Putnam <jeremyp@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
work around the issue where creating a temp file whose basename
starts with '~' fails on ruby 1.9
ruby issue: https://bugs.ruby-lang.org/issues/7547
test plan: try to import the course linked in the ticket
fixes #CNVS-2922
Change-Id: Iafbbae05c90dbef22e73e6311379e3aeee0a5f32
Reviewed-on: https://gerrit.instructure.com/16796
Tested-by: Jenkins <jenkins@instructure.com>
QA-Review: Adam Phillipps <adam@instructure.com>
Reviewed-by: Jeremy Stanley <jeremy@instructure.com>
refs #11857
don't allow zip files with more than
100000 files to get attached
don't allow zip files that add enough
data (with a minimum file size of 512)
to go over the context quota
also refactor unzip_attachment.rb a
bit as long as we're in there because
it's a bit dense and monolithic. There
is still much that could be done there,
but it's not one enormous method anymore.
TEST PLAN:
1) login as any user with permissions
to upload files.
2) attempt to upload a zip archive with
more than the configured max number of
files inside of it (currently 100,000)
3) you should get an error preventing
this action from occuring and no
new attachments should have been made
to that context
4) navigate to some context where the
attachment quota is known.
5) attempt to upload a zip archive to
that context with enough size to exceed
that quota.
6) you should get an error preventing
any of the new attachments from being
attached to that context.
Change-Id: I35ce673e96fb98728cb36cfd27538fd802a249f2
Reviewed-on: https://gerrit.instructure.com/15671
Reviewed-by: Cody Cutrer <cody@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Clare Hetherington <clare@instructure.com>
Adds support for optionally viewing documents with Crocodoc.
closes#9865
Test plan:
* configure the crocodoc plugin
* add an assignment that allows file uploads
* make a submission for that assignment with a pdf or doc or ppt
- on the 'submission details' page, opening a preview of the
assignment should display it in crocodoc
- speedgrader should display the submission in crocodoc too
* make a submission with odt or rtf
- the submission should be displayed with scribd or google docs
* if you disable the crocodoc plugin, submissions could continue being
previewed in google docs or scribd
Change-Id: I7dd2547f8e2d907c98ebe894a7f1ee9d58f1e030
Reviewed-on: https://gerrit.instructure.com/13668
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Jon Jensen <jon@instructure.com>
Test plan:
(We need two users here because Canvas doesn't notify you about
files you upload yourself. We'll call them Student and Teacher
here, but they don't actually have to be these things.)
* As Student, enable notifications for new files in Profile.
* As Teacher, upload a file.
* Within an hour or so (everything about notifications occurs
in low-priority background tasks), Student should receive
a notification for the file.
* As Teacher, upload multiple files.
* Student should eventually receive a notification that
X number of files were added.
Note that files are batched over a five-minute period; that is,
if a file is added to a course within five minutes of a previous
file, it will be counted in the same batch.
Change-Id: I09b5f497cae1d726b7aaf85824e98e69e45b0c1b
Reviewed-on: https://gerrit.instructure.com/12346
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Simon Williams <simon@instructure.com>
also fix/enable zip file uploads in group and user contexts -- they were
partially enabled, but broken. This required generalizing
UnzipAttachment to work for any context, not just courses, though that
was mostly just a matter of renaming things.
The zip file uploads in accounts are still not enabled, as the accounts
file section is not implemented yet, though it's referenced in the
routes file.
fixes#5913fixes#5728fixes#5463fixes#5012
test plan:
* upload a zip file to a course, to a group, and to a user's files. in
each case, try uploading the zip both through the button in the file
browser, and by dragging a zip file into the file browser (in a
capable web browser)
Change-Id: I6c648ef677d2bd61ae41a2b8fe0f89be43d63375
Reviewed-on: https://gerrit.instructure.com/7402
Tested-by: Hudson <hudson@instructure.com>
Reviewed-by: Zach Wily <zach@instructure.com>
Somehow the after_attachment_saved callback in Attachment was getting called
on non-scribdable attachments with a workflow_state of 'processing'. We were
previously only skipping non-scribdable attachments if the workflow_state was
'pending_upload'. Now we will skip scribd processing for any non-scribdable
attachment, no matter it's state.
Also changed UnzipAttachment to only create a scribd job if there are any
scribdable attachments.
test plan:
* Since we're not sure how the attachments originally got in the state
described above, it's hard to describe repro steps. However, if you upload
some images, they should not get scribd jobs created for them.
Change-Id: I7381af3f0928c2decf4f224834780cc90fbbc103
Reviewed-on: https://gerrit.instructure.com/8028
Reviewed-by: Brian Palmer <brianp@instructure.com>
Tested-by: Hudson <hudson@instructure.com>
update_all's update hash doesn't have any magic performed on bare Time
objects; it assumes any Time object it's given is already in UTC. using
a TimeWithZone object (regardless of timezone), which Fixnum#ago and
friends happen to return, is still fine.
Change-Id: I297b2a3211b896b5225ebcfaaee3c1eb56e55fb6
Reviewed-on: https://gerrit.instructure.com/5351
Tested-by: Hudson <hudson@instructure.com>
Reviewed-by: Jon Jensen <jon@instructure.com>
the tmp file was getting closed before FileInContext does its thing.
Change-Id: Ib2145552e18f9162c0ae87e5626bb5c6a12a3a0b
Reviewed-on: https://gerrit.instructure.com/4772
Tested-by: Hudson <hudson@instructure.com>
Reviewed-by: Bracken Mosbacker <bracken@instructure.com>
This was already a small issue if the job queue was on a different
database driver than the main database, and it'll become more important
as more AR connections are introduced.
Change-Id: I204becadd32bb935df096e8c937a04bb6962f0b2
Reviewed-on: https://gerrit.instructure.com/4601
Reviewed-by: Cody Cutrer <cody@instructure.com>
Tested-by: Hudson <hudson@instructure.com>