Skip to content

Commit

Permalink
paste.debian.net/paste.grml.org: Tolerate absence of trailing slashes.
Browse files Browse the repository at this point in the history
The trailing slash may be absent in both the web and curl versions.

Fixes #3.

Raises #4.
  • Loading branch information
danielshahaf committed Apr 1, 2016
1 parent f2abd11 commit 9fdc8a7
Showing 1 changed file with 12 additions and 8 deletions.
20 changes: 12 additions & 8 deletions caste
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,14 @@ class Test_Transform(unittest.TestCase):
pairs = (
('http://pastebin.com/Yas84GQN', 'http://pastebin.com/raw/Yas84GQN'),
('http://hastebin.com/ufogotebaw.anything', 'http://hastebin.com/raw/ufogotebaw'),
('https://paste.debian.net/361351/', 'https://paste.debian.net/plain/361351'),
('https://paste.debian.net/hidden/1d8a7b32/', 'https://paste.debian.net/plainh/1d8a7b32'),
('http://paste.grml.org/2643/', 'http://paste.grml.org/plain/2643'),
('https://paste.grml.org/hidden/1d8a7b32/', 'https://paste.grml.org/plainh/1d8a7b32'),
('https://paste.debian.net/361351', 'https://paste.debian.net/plain/361351'),
('https://paste.debian.net/361351/', 'https://paste.debian.net/plain/361351/'),
('https://paste.debian.net/hidden/1d8a7b32', 'https://paste.debian.net/plainh/1d8a7b32'),
('https://paste.debian.net/hidden/1d8a7b32/', 'https://paste.debian.net/plainh/1d8a7b32/'),
('http://paste.grml.org/2643', 'http://paste.grml.org/plain/2643'),
('http://paste.grml.org/2643/', 'http://paste.grml.org/plain/2643/'),
('https://paste.grml.org/hidden/1d8a7b32', 'https://paste.grml.org/plainh/1d8a7b32'),
('https://paste.grml.org/hidden/1d8a7b32/', 'https://paste.grml.org/plainh/1d8a7b32/'),
('http://paste.opensuse.org/85382826', 'http://paste.opensuse.org/view/raw/85382826'),
('http://susepaste.org/77951426', 'http://susepaste.org/view/raw/77951426'),
('https://bpaste.net/show/b189be90c71f', 'https://bpaste.net/raw/b189be90c71f'),
Expand Down Expand Up @@ -43,10 +47,10 @@ class Test_Transform(unittest.TestCase):
REPLACEMENTS = (
(r'(://pastebin.com)/([A-Za-z0-9_]+)', r'\1/raw/\2'),
(r'(://hastebin.com)/([A-Za-z0-9_]+)\..*', r'\1/raw/\2'),
(r'(://paste.debian.net)/(\d+)/', r'\1/plain/\2'),
(r'(://paste.debian.net)/hidden/([a-f0-9]+)/', r'\1/plainh/\2'),
(r'(://paste.grml.org)/(\d+)/', r'\1/plain/\2'),
(r'(://paste.grml.org)/hidden/([a-f0-9]+)/', r'\1/plainh/\2'),
(r'(://paste.debian.net)/(\d+)', r'\1/plain/\2'),
(r'(://paste.debian.net)/hidden/([a-f0-9]+)', r'\1/plainh/\2'),
(r'(://paste.grml.org)/(\d+)', r'\1/plain/\2'),
(r'(://paste.grml.org)/hidden/([a-f0-9]+)', r'\1/plainh/\2'),
(r'(://paste.opensuse.org)/(\d+)', r'\1/view/raw/\2'),
(r'(://susepaste.org)/(\d+)', r'\1/view/raw/\2'),
(r'(://bpaste.net)/show/([a-f0-9]+)', r'\1/raw/\2'),
Expand Down

0 comments on commit 9fdc8a7

Please sign in to comment.