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>