summaryrefslogtreecommitdiff
path: root/app/models/blob.rb
Commit message (Collapse)AuthorAgeFilesLines
* Remove dependencies on LinguistZeger-Jan van de Weg2018-10-121-1/+1
| | | | | | | | | | | | | | | | This saves about 128 MB of baseline RAM usage per Unicorn and Sidekiq process (!). Linguist wasn't detecting languages anymore from CE/EE since 9ae8b57467ac8b38f1fa9020a466d94a93cbb9dd. However, Linguist::BlobHelper was still being depended on by BlobLike and others. This removes the Linguist gem, given it isn't required anymore. EscapeUtils were pulled in as dependency, but given Banzai depends on it, it is now added explicitly. Previously, Linguist was used to detect the best ACE mode. Instead, we rely on ACE to guess the best mode based on the file extension.
* Enable frozen string in app/models/*.rbrepo-forks/gitlab-ce-frozen-string-enable-app-modelsgfyoung2018-07-261-0/+2
| | | | Partially addresses #47424.
* 26039 - update github-linguist to 5.3.3 versionKen2018-02-211-1/+1
| | | | | | | | 26039 - add merge request id 26039 change due to lingust source file updates
* Include project in BatchLoader key to prevent returning blobs for the wrong ↵Douwe Maan2017-12-141-3/+9
| | | | project
* Batchload blobs for diff generationZeger-Jan van de Weg2017-11-211-1/+16
| | | | | | | | | | | | | | | | | | 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
* Match full file path in FileDetectorSean McGivern2017-10-121-1/+3
| | | | | | | | | The basename appears to have been a holdover from the past - it doesn't look necessary now. Some of the regexes were unanchored on one side, so explicitly ensure that they only match the root. Apart from that, this means that pushing to foo/README.md will no longer invalidate the main README cache for a project.
* Detect if file that appears to be text in the first 1024 bytes is actually ↵dm-blob-binaryness-changeDouwe Maan2017-06-081-2/+5
| | | | binary afer loading all data
* Merge branch 'dm-blob-file-type' into 'master'Grzegorz Bizon2017-06-081-0/+4
|\ | | | | | | | | Add Blob#file_type convenience method See merge request !11982
| * Add Blob#file_type convenience methoddm-blob-file-typeDouwe Maan2017-06-081-0/+4
| |
* | Merge branch 'dm-empty-blob-viewer-binary' into 'master'Grzegorz Bizon2017-06-081-1/+1
|\ \ | |/ |/| | | | | Empty blob viewer isn’t binary-only See merge request !11979
| * Empty blob viewer isn’t binary-onlydm-empty-blob-viewer-binaryDouwe Maan2017-06-071-1/+1
| |
* | Blob#load_all_data! doesn’t need an argumentblob-load-all-dataDouwe Maan2017-06-071-0/+4
|/
* Consistent diff and blob size limit namesDouwe Maan2017-05-291-8/+4
|
* Merge branch 'dm-gemfile-viewer'Rémy Coutable2017-05-181-1/+13
|\ | | | | | | See merge request !11346.
| * Add auxiliary blob viewers to dependency filesDouwe Maan2017-05-171-1/+13
| |
* | Add auxiliary viewer for READMEdm-readme-viewerDouwe Maan2017-05-171-0/+1
|/
* Add auxiliary blob viewer for CHANGELOGDouwe Maan2017-05-171-1/+2
|
* Add auxiliary viewer for CONTRIBUTINGdm-contributing-viewerDouwe Maan2017-05-161-1/+3
|
* Implement auxiliary blob viewersDouwe Maan2017-05-101-12/+22
|
* Enable the Style/TrailingCommaInLiteral copRémy Coutable2017-05-101-1/+1
| | | | | | Use the EnforcedStyleForMultiline: no_comma option. Signed-off-by: Rémy Coutable <remy@rymai.me>
* Merge branch 'balsalmiq-support' into 'master' Phil Hughes2017-05-051-0/+1
|\ | | | | | | | | Initial balsamiq support See merge request !10564
| * Merge branch 'master' into balsalmiq-supportLuke "Jared" Bennett2017-04-301-0/+2
| |\
| * \ Merge branch 'master' into balsalmiq-supportLuke "Jared" Bennett2017-04-281-60/+118
| |\ \
| * | | BE review changesLuke "Jared" Bennett2017-04-121-1/+1
| | | |
| * | | Merge branch 'master' into 'balsalmiq-support'Luke "Jared" Bennett2017-04-121-5/+25
| |\ \ \ | | | | | | | | | | | | | | | # Conflicts: # app/models/blob.rb
| * | | | Initial balsamiq supportJacob Schatz2017-04-101-0/+6
| | | | |
* | | | | Refactor Blob support of external storage in preparation of job artifact blobsdm-blob-external-storageDouwe Maan2017-05-031-16/+30
| |_|_|/ |/| | |
* | | | Display video blobs in-line like imagesdm-video-viewerDouwe Maan2017-04-281-0/+2
| |_|/ |/| |
* | | Explain how viewers are selected from RICH_VIEWERSDouwe Maan2017-04-271-7/+27
| | |
* | | Add specsDouwe Maan2017-04-271-2/+2
| | |
* | | Small code tweaksDouwe Maan2017-04-271-12/+18
| | |
* | | Add BlobViewer::Base#binary? methodDouwe Maan2017-04-271-20/+24
| | |
* | | Refactor overriding max sizeDouwe Maan2017-04-271-3/+8
| | |
* | | Address feedbackDouwe Maan2017-04-271-5/+3
| | |
* | | Add test stubsDouwe Maan2017-04-271-2/+2
| | |
* | | Add rich blob viewersDouwe Maan2017-04-271-0/+8
| | |
* | | Refactor Blob and add BlobViewer::BaseDouwe Maan2017-04-271-56/+70
| | |
* | | Pass project to BlobDouwe Maan2017-04-271-2/+10
| |/ |/|
* | Don't show 'Copy content' button on text files that are not rendered as textDouwe Maan2017-04-101-5/+25
|/
* STL file viewerPhil Hughes2017-04-061-0/+6
|
* Use PDFLab to render PDFs in GitLabSam Rose2017-04-051-0/+6
|
* Load a preview of Sketch 43 filessketch-preview-filesJacob Schatz2017-04-051-0/+6
| | | | | | | 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
* Added worksheets support to notebook viewerPhil Hughes2017-03-301-1/+1
| | | | Updated some Ruby code based on comments
* Started iPython notebook viewerPhil Hughes2017-03-231-0/+6
| | | | | | Using NotebookLab library [ci skip]
* Do not show LFS object when LFS is disabledChristopher Bartz2017-03-131-2/+6
| | | | | | 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.
* Handle encoding in non-binary Blob instancesupdate-gitlab-gitYorick Peterse2016-09-141-0/+12
| | | | | | | | | | | | | | | | 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.
* Limit the size of SVGs when viewing them as blobssvg-render-size-limitYorick Peterse2016-08-151-0/+7
| | | | | | | | | 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
* Ensure relative paths for video are rewritten as we do for images20189-markdown-video-doesn-t-work-when-the-referenced-video-file-is-in-same-repoRémy Coutable2016-07-261-0/+4
| | | | Signed-off-by: Rémy Coutable <remy@rymai.me>
* Fix Error 500 when viewing a blob with binary characters after the 1024-byte ↵Stan Hu2016-06-121-1/+1
| | | | | | | | | | | | | | | | mark Here was the problem: 1. When determining whether a given blob is viewable text, gitlab_git reads the first 1024 bytes and checks with Linguist whether it is a text or binary file. 2. If the blob is text, GitLab will attempt to display it. 3. However, if the text has binary characters after the first 1024 bytes, then GitLab will attempt to load the entire contents, but the encoding will be ASCII-8BIT since there are binary characters. 4. The Error 500 results when GitLab attempts to display a mix UTF-8 and ASCII-8BIT. To fix this, we load as much data as we are willing to display so that the detection will work properly. Requires an update to gitlab_git: gitlab-org/gitlab_git!86 Closes #13826
* Properly handle bigger filesZeger-Jan van de Weg2016-04-281-0/+8
|