Commit Graph

9 Commits

Author SHA1 Message Date
Jeremy Stanley 9a6a2c0e59 use display_name for mime type when uploading tempfile
test plan:
 - have canvas set up with inst-fs
 - put an SVG file in course files
 - in the files tab, you should be able to click the SVG and
   see a preview
 - export the course to a canvas cartridge
 - import it to another course
 - the file preview should work in the new course

fixes LS-1602

flag = none

Change-Id: Ib6a66a803a23be66eb62244a90e03dd76258e96d
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/254507
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Ed Schiebel <eschiebel@instructure.com>
QA-Review: Robin Kuss <rkuss@instructure.com>
Product-Review: Jeremy Stanley <jeremy@instructure.com>
2020-12-08 20:49:42 +00:00
Cody Cutrer d6e044ff76 add # frozen_string_literal: true for embedded gems
Change-Id: Ib49bc8939cf1706e758429e531a87c57d0231a37
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/251156
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Simon Williams <simon@instructure.com>
QA-Review: Simon Williams <simon@instructure.com>
Product-Review: Simon Williams <simon@instructure.com>
2020-10-28 22:08:40 +00:00
Jacob Fugal 815821a762 restore and fix "stream inst-fs direct uploads"
fixes RECNVS-583, RECNVS-594, RECNVS-595

reverts commit efdb13e9a9, restoring
3da400a75e, but adds fixes for the bugs
that caused the original revert. in particular:

* refactor to avoid `eof?` (RECNVS-594)

  in some situations, the file contents stream doesn't implement `eof?`.
  the only required interface for `IO.copy_stream` is `size` and `read`,
  so we'll restrict our interface to that and only expect no more than
  that interface of the parts.

* keep trying the same stream on partial read (RECNVS-595)

  the IO#read docs indicate that if the read result has fewer than the
  bytes requested, it's because the stream is at EOF. the
  SequencedStream output sticks to that behavior. but in some
  situations, the file contents stream will return a partial read before
  EOF. so we need to keep asking for the remainder until we either get
  as much as we wanted or an explicit EOF (nil returned).

test-plan:
- ensure the following all still work with inst-fs enabled:
  - content exports, particularly of larger courses. don't just verify
    the file is created and can be downloaded from inst-fs, but the
    generated file should also be a valid zip file (file extension is
    imscc, but format is zip) that can be extracted into the expected
    course contents. exercises RECNVS-595
  - content migrations, particularly of larger courses, where you choose
    a source Canvas course when executing "Import Course Content" in a
    destination Canvas course. also exercises RECNVS-595.
  - SIS imports via API
    - create a simple courses.csv with a new course defined in it a la
      https://canvas.instructure.com/doc/api/file.sis_csv.html
    - POST this CSV to the SIS imports API documented at
      https://canvas.instructure.com/doc/api/sis_imports.html#method.sis_imports_api.create
      use the mechanism described under the text "If you decide to do a raw post,
      you can skip the 'attachment' argument..." in the description of
      the attachment parameter. exercises RECNVS-594.

Change-Id: Ie7e7fecff491ac2344a48d97f1c6b27eb24885c8
Reviewed-on: https://gerrit.instructure.com/162584
Reviewed-by: Xander Moffatt <xmoffatt@instructure.com>
Tested-by: Jenkins
Product-Review: Xander Moffatt <xmoffatt@instructure.com>
QA-Review: Xander Moffatt <xmoffatt@instructure.com>
2018-08-30 18:37:07 +00:00
Jonathan Featherstone efdb13e9a9 Revert "stream inst-fs direct uploads"
This reverts commit 3da400a75e.

closes RECNVS-592

Change-Id: I51fb152a1ceef45a51b4434575afd1b25a955aa5
Reviewed-on: https://gerrit.instructure.com/162120
Reviewed-by: Keith T. Garner <kgarner@instructure.com>
Tested-by: Jenkins
Product-Review: Jonathan Featherstone <jfeatherstone@instructure.com>
QA-Review: Jonathan Featherstone <jfeatherstone@instructure.com>
2018-08-25 16:18:04 +00:00
Jacob Fugal 3da400a75e stream inst-fs direct uploads
fixes RECNVS-547

generally, in Multipart::Post, you can get a stream representation of
the body instead of a string, and in CanvasHttp.post you can request
that stream be supplied to the underlying request's body_stream instead
of the string to the underlying body. inst-fs then supplies the
streaming flag during direct upload.

this avoids an error when the body as a single string is too large to
POST.

test-plan:
- confirm general upload-from-canvas functionality is preserved by
  triggering uploads from canvas to another server
  - e.g. inst-fs enabled course export
  - e.g. inst-fs enabled course export
- confirm specific upload-from-canvas functionality with streamed larger
  files
  - i.e. inst-fs enabled course export where the export size is larger
    than 2GB
  - note that there may be a new HTTP 504 error when the upload size
    approaches 3GB. this is a separate issue not related to this commit

Change-Id: I15e22e6688233a77783d1cd86960bbaaa64eb0dc
Reviewed-on: https://gerrit.instructure.com/160105
Reviewed-by: Cody Cutrer <cody@instructure.com>
Tested-by: Jenkins
QA-Review: Michael Jasper <mjasper@instructure.com>
Product-Review: Jacob Fugal <jacob@instructure.com>
2018-08-20 22:00:35 +00:00
Landon Wilkins c5b5cc786d da licença part 53
add consistent license headers to all source files

Change-Id: I405d2def01ad68c76533b9254983497485cd7073
Reviewed-on: https://gerrit.instructure.com/110160
Reviewed-by: Landon Wilkins <lwilkins@instructure.com>
Tested-by: Jenkins
Reviewed-by: Jon Jensen <jon@instructure.com>
Product-Review: Jon Jensen <jon@instructure.com>
QA-Review: Jon Jensen <jon@instructure.com>
2017-05-01 21:06:11 +00:00
Simon Williams 359c6dea13 upgrade many canvas gems to rspec 3 syntax
as of this commit, all canvas gems should be on rspec 3.5, and pass
without deprecation warnings.

closes CNVS-34040

test plan: specs should pass without deprecation warnings

Change-Id: I556b1a4a5aeb791c6ddd50ee35b51c513e025019
Reviewed-on: https://gerrit.instructure.com/98414
Reviewed-by: Landon Wilkins <lwilkins@instructure.com>
Product-Review: Landon Wilkins <lwilkins@instructure.com>
QA-Review: Landon Wilkins <lwilkins@instructure.com>
Tested-by: Jenkins
2016-12-27 18:44:23 +00:00
Simon Williams 4f1b79337c fix Multipart::Post Content-type header
This reverts commit e3148346df
This reverts commit 16f518a130
This partially reverts 9d34baed66

fixes CNVS-12021

test plan (e3148346df)
 - rails 3 specs should pass
test plan (9d34baed66)
 - import content including a video file into a course
      (such as the QTI file attached to CNVS-11602)
 - the import should complete
test plan (16f518a130)
 - submit a document to turnitin
 - it should successfully receive a score

Change-Id: I0622d9eceee4b94e488f103db68290f1b641b555
Reviewed-on: https://gerrit.instructure.com/32333
Reviewed-by: Brian Palmer <brianp@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
QA-Review: Amber Taniuchi <amber@instructure.com>
Reviewed-by: Jeremy Stanley <jeremy@instructure.com>
Product-Review: Jeremy Stanley <jeremy@instructure.com>
2014-03-26 15:21:09 +00:00
Raphael Weiner 4dc762217a extract multipart gem
Change-Id: Id4aa4d522bba2d87008d02249893a65387ec563c
Reviewed-on: https://gerrit.instructure.com/30052
Reviewed-by: Brian Palmer <brianp@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
QA-Review: Amber Taniuchi <amber@instructure.com>
Product-Review: Simon Williams <simon@instructure.com>
2014-02-28 23:00:09 +00:00