Commit Graph

29 Commits

Author SHA1 Message Date
GitLab Bot 413119517c Add latest changes from gitlab-org/gitlab@master 2021-04-07 18:09:45 +00:00
GitLab Bot dad48b4af2 Add latest changes from gitlab-org/gitlab@master 2021-03-16 15:11:17 +00:00
GitLab Bot 325318e2dd Add latest changes from gitlab-org/gitlab@master 2020-08-17 09:10:08 +00:00
GitLab Bot d6348d22dd Add latest changes from gitlab-org/gitlab@master 2020-06-24 09:08:32 +00:00
GitLab Bot 00ecf5debe Add latest changes from gitlab-org/gitlab@master 2020-06-04 18:08:32 +00:00
GitLab Bot b64a8161c9 Add latest changes from gitlab-org/gitlab@master 2020-05-29 18:08:26 +00:00
GitLab Bot 100a5e4bea Add latest changes from gitlab-org/gitlab@master 2020-05-25 21:08:00 +00:00
GitLab Bot 39fa1b5987 Add latest changes from gitlab-org/gitlab@master 2020-04-27 09:09:51 +00:00
GitLab Bot ae96e65ee2 Add latest changes from gitlab-org/gitlab@master 2020-04-22 12:09:29 +00:00
GitLab Bot 62fcb9ffa9 Add latest changes from gitlab-org/gitlab@master 2019-12-22 06:07:52 +00:00
GitLab Bot 6a7cc8c147 Add latest changes from gitlab-org/gitlab@master 2019-12-05 18:07:51 +00:00
GitLab Bot 8f210aebe1 Add latest changes from gitlab-org/gitlab@master 2019-10-31 21:06:28 +00:00
GitLab Bot 8c7eab92cd Add latest changes from gitlab-org/gitlab@master 2019-10-23 03:06:01 +00:00
GitLab Bot 0a850868df Add latest changes from gitlab-org/gitlab@master 2019-10-09 12:06:13 +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
Robert Speicher fe22704a20
Merge branch 'master' of dev.gitlab.org:gitlab/gitlabhq 2019-07-29 13:19:50 -05:00
Kerri Miller acc694ead6 Extract SanitizeNodeLink and apply to WikiLinkFilter
The SanitizationFilter was running before the WikiFilter. Since
WikiFilter can modify links, we could see links that _should_ be stopped
by SanatizationFilter being rendered on the page. I (kerrizor) had
previously addressed the bug in: 7bc971915b
However, an additional exploit was discovered after that was merged.
Working through the issue, we couldn't simply shuffle the order of
filters, due to some implicit assumptions about the order of filters, so
instead we've extracted the logic that sanitizes a Nokogiri-generated
Node object, and applied it to the WikiLinkFilter as well.

On moving filters around:
Once we start moving around filters, we get cascading failures; fix one,
another one crops up. Many of the existing filters in the WikiPipeline
chain seem to assume that other filters have already done their work,
and thus operate on a "transform anything that's left" basis;
WikiFilter, for instance, assumes any link it finds in the markdown
should be prepended with the wiki_base_path.. but if it does that, it
also turns `href="@user"` into `href="/path/to/wiki/@user"`, which the
UserReferenceFilter doesn't see as a user reference it needs to
transform into a user profile link. This is true for all the reference
filters in the WikiPipeline.
2019-07-26 13:41:11 +00:00
Thong Kuah f540ffcef6 Add frozen_string_literal to spec/lib (part 1)
Using the sed script from
https://gitlab.com/gitlab-org/gitlab-ce/issues/59758
2019-07-26 13:25:07 +12:00
Brett Walker 644296d67b Resolve "Wiki page attachments not rendered properly" 2018-09-07 14:27:44 +00:00
Brett Walker e41b999432 test that wiki links with spaces works in wiki pipeline 2018-09-05 09:19:16 -05:00
Robert Speicher 72a7b30c9f Change all `:empty_project` to `:project` 2017-08-02 17:47:31 -04:00
Qingping Hou 5c9376f90d Fix URLs with anchors in wiki 2016-09-13 23:53:40 -07:00
Grzegorz Bizon 9e211091a8 Enable Style/EmptyLines cop, remove redundant ones 2016-07-01 21:56:17 +02:00
Paco Guzman be98ee2586
Fixing specs stubbed objects cannot access database 2016-06-10 15:41:56 +02:00
Timothy Andrew 8e71c19a69 Implement the correct linking behaviour in `WikiLinkFilter`.
Original Comments
=================

- Linking behaves as per rules documented here:
  https://gitlab.com/gitlab-org/gitlab-ce/blob/16568-document-wiki-linking-behavior/doc/markdown/wiki.md
- All links (to other wiki pages) are rewritten to be at the level of
  the app root. We can't use links relative to the current
  page ('./foo', 'foo', '../foo'), because they won't work in the
  markdown preview, where the current page is suffixed with `/edit`
- Move existing `WikiLinkFilter` specs to `WikiPipeline` spec. It makes
  sense to run these tests on the combined output of the pipeline,
  rather than a single filter, since we can catch issues with
  conflicting filters.
- Add more tests to cover the new linking

@rymai's Review
===============

- Classes nested under `WikiLinkFilter` should declare `WikiLinkFilter`'s
  inherit, so nothing changes if the nested class is loaded first.
- Add a blank line after a guard clause
- Use keyword arguments for the `Rewriter` constructor
- Invert a condition - use `if` instead of `unless`
- Inline a `let` in `WikiPipeline` spec - it was only used in a single place
- Change out of date spec names
- Add a comment for every rewrite rule in `Rewriter`
2016-06-09 10:04:15 +05:30
Gabriel Mazetto 1575a95b65 little refactor and improvements on specs 2016-04-06 20:09:15 -03:00
Gabriel Mazetto 61fe0a2397 Fixed WikiPipeline and specs 2016-04-06 03:12:39 -03:00
Robert Speicher def6446dad Replace `[[_TOC_]]` tag even if `toc` result is blank 2016-03-03 12:41:40 -05:00
Robert Speicher 82bc6c6229 Add a spec for WikiPipeline
Removes the specs from GollumTagsFilter that were more like integration
tests for the pipeline than unit tests of the filter.
2016-03-01 16:59:56 -05:00