Commit Graph

35 Commits

Author SHA1 Message Date
GitLab Bot 6d05fbc478 Add latest changes from gitlab-org/gitlab@master 2022-04-04 18:08:38 +00:00
GitLab Bot 3bdc719293 Add latest changes from gitlab-org/gitlab@master 2022-02-01 15:18:50 +00:00
GitLab Bot c59765a50a Add latest changes from gitlab-org/gitlab@master 2020-06-24 18:09:03 +00:00
GitLab Bot 40cdcdd45b Add latest changes from gitlab-org/gitlab@master 2020-05-18 18:08:22 +00:00
GitLab Bot ae96e65ee2 Add latest changes from gitlab-org/gitlab@master 2020-04-22 12:09:29 +00:00
GitLab Bot 0ab47b994c Add latest changes from gitlab-org/gitlab@master 2020-02-13 15:08:52 +00:00
GitLab Bot 208e2e308c Add latest changes from gitlab-org/gitlab@master 2020-02-02 06:08:56 +00:00
GitLab Bot 1caa60060b Add latest changes from gitlab-org/gitlab@master 2019-12-19 00:08:01 +00:00
GitLab Bot c2b98d3dbd Add latest changes from gitlab-org/gitlab@master 2019-12-17 15:08:15 +00:00
GitLab Bot 00c78fb814 Add latest changes from gitlab-org/gitlab@master 2019-10-16 15:06:17 +00:00
GitLab Bot bd860c22f6 Add latest changes from gitlab-org/gitlab@master 2019-09-17 12:06:48 +00:00
Ash McKenzie 19ff9d9899
Replace rails_helper.rb with spec_helper.rb
rails_helper.rb's only logic was to require
spec_helper.rb.
2019-08-30 12:26:18 +10:00
Sean McGivern 1885691b03 Ensure that we only request blobs in one batch
Blob.lazy adds a blob to a batch to load at a later point, using the
BatchLoader library. Whenever any lazy blob's attributes are accessed,
all lazy blobs requested to that point will be loaded.

BatchLoader, the library we use for this, should only request items in a
batch once. That is, if we have these batches:

1. a, b, c
2. d, e, f

Then a, b, and c should only be requested in the first batch. But if you
modify the list of items in the batch, then the second batch will
request a, b, c, d, e, f, which is almost certainly not what we want!

https://github.com/exAspArk/batch-loader/issues/44 is the upstream issue
for this, but we can also solve this in our application by not modifying
the arguments we're using inside a BatchLoader batch.
2019-04-24 14:13:32 +01:00
Thong Kuah a2cfc150ce Add # frozen_string_literal to spec/models
Adds `# frozen_string_literal: true` to spec/models ruby files
2019-04-01 14:37:54 +13:00
Francisco Javier López 5a3e6fdff9
Fixing image lfs bug and also displaying text lfs
This commit, introduced in https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/23812,
fixes a problem creating a displaying image diff notes when the image
is stored in LFS. The main problem was that `Gitlab::Diff::File` was
returning an invalid valid in `text?` for this kind of files.

It also fixes a rendering problem with other LFS files, like text
ones. They LFS pointer shouldn't be shown when LFS is enabled
for the project, but they were.
2018-12-27 16:51:07 +01:00
Douwe Maan af5d7dea7f
Update batch-loader dependency 2018-12-04 13:00:16 +01:00
Douwe Maan 5f0e4040ce
Batch load only data from same repository when lazy object is accessed
By specifying `key`, we get a different lazy batch loader for each
repository, which means that accessing a lazy object from one repository
will only result in that repository's objects being fetched, not those
of other repositories, saving us some unnecessary Gitaly lookups.
2018-11-26 11:15:18 +01:00
Zeger-Jan van de Weg f9565e3039
Batchload blobs for diff generation
After installing a new gem, batch-loader, a construct can be used to
queue data to be fetched in bulk. The gem was also introduced in both
gitlab-org/gitlab-ce!14680 and gitlab-org/gitlab-ce!14846, but those mrs
are not merged yet.

For the generation of diffs, both the old blob and the new blob need to
be loaded. This for every file in the diff, too. Now we collect all
these so we do 1 fetch. Three `.allow_n_plus_1_calls` have been removed,
which I expect to be valid, but this needs to be confirmed by a full CI
run.

Possibly closes:
- https://gitlab.com/gitlab-org/gitlab-ce/issues/37445
- https://gitlab.com/gitlab-org/gitlab-ce/issues/37599
- https://gitlab.com/gitlab-org/gitlab-ce/issues/37431
2017-11-21 13:53:26 +01:00
Robert Speicher 72a7b30c9f Change all `:empty_project` to `:project` 2017-08-02 17:47:31 -04:00
Douwe Maan 369d681eec Add Blob#file_type convenience method 2017-06-08 10:07:17 -05:00
Douwe Maan 08706f6837 Implement auxiliary blob viewers 2017-05-10 20:07:04 -05:00
Douwe Maan 720cc14a75 Refactor Blob support of external storage in preparation of job artifact blobs 2017-05-03 10:20:05 -05:00
Douwe Maan 87a3bd26fa Address feedback 2017-04-27 12:23:27 -05:00
Douwe Maan 964e7d206b Add specs 2017-04-27 12:23:26 -05:00
Douwe Maan fed9dcd9ed Add test stubs 2017-04-27 12:23:26 -05:00
Douwe Maan fb8a12c8fe Don't show 'Copy content' button on text files that are not rendered as text 2017-04-10 21:23:19 +00:00
Phil Hughes e992799ce5 STL file viewer 2017-04-06 10:02:24 +00:00
Sam Rose dad30d6bbf Use PDFLab to render PDFs in GitLab 2017-04-05 11:22:12 -04:00
Jacob Schatz fd8a40783d Load a preview of Sketch 43 files
Sketch 43 files are technically a zip file, so the JavaScript opens the
zip file & locates a preview.png which is just a quick preview of the
last sketch page edited. After that is loaded it simply places the image
into the DOM
2017-04-05 11:49:08 +01:00
Phil Hughes 0ef8585726 Added tests 2017-03-23 12:37:24 +00:00
Christopher Bartz 7849683766 Do not show LFS object when LFS is disabled
Do not display a 404, when a user tries to retrieve the raw content of
an LFS file (pointer) if the config option "lfs_enabled" is set to
false. Instead, display the LFS pointer file directly.
2017-03-13 18:15:19 +01:00
Yorick Peterse 0bc443e3b4
Handle encoding in non-binary Blob instances
gitlab_git 10.6.4 relies on Rugged marking blobs as binary or not,
instead of relying on Linguist. Linguist in turn would mark text blobs
as binary whenever they would contain byte sequences that could not be
encoded using UTF-8.

However, marking such blobs as binary is not correct. If one pushes a
Markdown document with invalid character sequences it's still a text
based Markdown document and not some random binary blob.

This commit overwrites Blob#data so it automatically converts text-based
content to UTF-8 (the encoding we use everywhere else) while taking care
of replacing any invalid sequences with the UTF-8 replacement character.
The data of binary blobs is left as-is.
2016-09-14 14:15:31 +02:00
Yorick Peterse 8171544b3d
Limit the size of SVGs when viewing them as blobs
This ensures that SVGs greater than 2 megabytes are not scrubbed and
rendered. This in turn prevents requests from timing out due to
reading/scrubbing large SVGs potentially taking a lot of time (and
memory). The use of 2 megabytes is completely arbitrary.

Fixes gitlab-org/gitlab-ce#1435
2016-08-15 13:42:52 +02:00
Rémy Coutable 939436480c Ensure relative paths for video are rewritten as we do for images
Signed-off-by: Rémy Coutable <remy@rymai.me>
2016-07-26 10:22:17 +02:00
Robert Speicher 8c454b3624 Add a `Blob` model that wraps `Gitlab::Git::Blob`
This allows us to take advantage of Rails' `to_partial_path` to render
the correct partial based on the Blob type, rather than cluttering the
view with conditionals.

It also allows (and will allow in the future) better encapsulation for
Blob-related logic which makes sense for our Rails app but might not
make as much sense for the core `gitlab_git` library, such as detecting
if the blob is an SVG.
2016-02-18 22:45:30 -05:00