Commit Graph

13 Commits

Author SHA1 Message Date
winniehell 17e3d3fde8 Avoid escaping relative links in Markdown twice (!7940) 2016-12-12 14:45:08 +01:00
winniehell ac2eb1cd01 Escape ref and path for relative links (!6050) 2016-10-24 22:18:34 +02:00
Robert Speicher bd1b8ae9bb Merge branch 'relative-link-filter-ref' into 'master'
Do not look up commit again when it is passed to RelativeLinkFilter

## What does this MR do?

Use `context[:commit]` in RelativeLinkFilter instead of looking up commit using `context[:ref]`.

## Why was this MR needed?

Even though the commit object was already passed, unnecessary I/O is done to retrieve the commit object.

## What are the relevant issue numbers?

Fixes #20026

See merge request !5455
2016-08-09 21:45:59 +00:00
winniehell b791dcc05b Ignore URLs starting with // (!5677) 2016-08-05 01:30:59 +02:00
winniehell e63eccf974 Do not look up commit again when it is passed to RelativeLinkFilter (!5455) 2016-08-02 21:52:52 +02:00
winniehell 40da543f2f Add support for relative links starting with ./ or / to RelativeLinkFilter (!5586) 2016-08-02 03:52:24 +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
Grzegorz Bizon 07be594378 Enable Style/MultilineTernaryOperator rubocop cop
Avoid multi-line ?: (the ternary operator). Use if/unless instead.

See #17478
2016-07-20 14:24:39 +02:00
Alejandro Rodríguez ca696175db Optimize Banzai::Filter::RelativeLinkFilter
A lot of git operations were being repeated, for example, to build a url
    you would ask if the path was a Tree, which would call a recursive routine
    in Gitlab::Git::Tree#where, then ask if the path was a Blob, which would
    call a recursive routine at Gitlab::Git::Blob#find, making reference to
    the same git objects several times. Now we call Rugged::Tree#path, which
    allows us to determine the type of the path in one pass.

    Some other minor improvement added, like saving commonly used references
    instead of calculating them each time.
2016-06-21 10:53:16 -04:00
Robert Speicher 8558483417 Remove redundant `require`s from Banzai files
We're trying to avoid circular dependency errors.
2016-03-24 13:23:47 -04:00
Douwe Maan 2a20c0e590 Prevent circular reference error in Banzai 2016-01-14 11:30:28 +01:00
Robert Speicher d9d2e8a3e8 Support a single directory traversal in RelativeLinkFilter
Prior, if we were viewing a blob at
`https://example.com/namespace/project/blob/master/doc/some-file.md` and
it contained a relative link such as `[README](../README.md)`, the
resulting link when viewing the blob would be:
`https://example.com/namespace/project/blob/README.md` which omits the
`master` ref, resulting in a 404.
2015-12-30 15:36:59 -05:00
Douwe Maan 7781bda9bd Move Markdown/reference logic from Gitlab::Markdown to Banzai 2015-12-15 15:51:16 +01:00