protocol-url 0.15.0 → 0.16.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +0 -0
- data/lib/protocol/url/path.rb +13 -0
- data/lib/protocol/url/version.rb +1 -1
- data/readme.md +41 -0
- data/releases.md +4 -0
- data.tar.gz.sig +0 -0
- metadata +1 -1
- metadata.gz.sig +0 -0
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 19ab80e6eb5272f7866b22b006ff4803adefdaa8913f35a81c8f1b79b0e60de6
|
|
4
|
+
data.tar.gz: 525c3a31f539f9250dab7a33e069785132ae7d86e0e1789e02dc1e9c0447d4c1
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 272e4b1d19ae57a938e2407b77f5d2f2f8df65df57bd7651459ccb104c8d52e4d8a765a8d4a4462ea2f0b365bbd2b6bde6dfe4b77ad005caf6f3ff2910757e77
|
|
7
|
+
data.tar.gz: 7c73a1a644c936e64c41d5c9c578dbee3b08eb9b1e735bc57ffe32b7193ef7edd43a28504ac9b8e600f1904365621059b4a2dd9f7398c81c897da925e7741a18
|
checksums.yaml.gz.sig
CHANGED
|
Binary file
|
data/lib/protocol/url/path.rb
CHANGED
|
@@ -372,12 +372,25 @@ module Protocol
|
|
|
372
372
|
common_length = i + 1
|
|
373
373
|
end
|
|
374
374
|
|
|
375
|
+
# Preserve the final segment when the target names the containing directory as a file:
|
|
376
|
+
if common_length > 0 && common_length == target_segments.size && target_segments.last != ""
|
|
377
|
+
common_length -= 1
|
|
378
|
+
end
|
|
379
|
+
|
|
375
380
|
# Calculate how many levels to go up
|
|
376
381
|
up_levels = from_segments.size - common_length
|
|
377
382
|
|
|
378
383
|
# Build the relative path segments
|
|
379
384
|
relative_segments = [".."] * up_levels + target_segments[common_length..-1]
|
|
380
385
|
|
|
386
|
+
# An empty reference identifies the current document, so identify the current directory explicitly:
|
|
387
|
+
if relative_segments == [""]
|
|
388
|
+
relative_segments = [".", ""]
|
|
389
|
+
elsif relative_segments.first&.include?(":")
|
|
390
|
+
# A colon in the first segment would be interpreted as a URI scheme:
|
|
391
|
+
relative_segments.unshift(".")
|
|
392
|
+
end
|
|
393
|
+
|
|
381
394
|
return Path.new(nil, relative_segments)
|
|
382
395
|
end
|
|
383
396
|
|
data/lib/protocol/url/version.rb
CHANGED
data/readme.md
CHANGED
|
@@ -34,6 +34,47 @@ bundle exec sus
|
|
|
34
34
|
|
|
35
35
|
Please see the [project releases](https://socketry.github.io/protocol-url/releases/index) for all releases.
|
|
36
36
|
|
|
37
|
+
### v0.16.0
|
|
38
|
+
|
|
39
|
+
- Preserve directory and file semantics when generating relative URL paths.
|
|
40
|
+
|
|
41
|
+
### v0.15.0
|
|
42
|
+
|
|
43
|
+
- Add `Protocol::URL::Relative#relative_to` for expressing root-relative URLs relative to a base path.
|
|
44
|
+
|
|
45
|
+
### v0.14.0
|
|
46
|
+
|
|
47
|
+
- Allow paths to compare with their encoded string representation.
|
|
48
|
+
|
|
49
|
+
### v0.13.0
|
|
50
|
+
|
|
51
|
+
- Add conservative normalization of encoded URL paths.
|
|
52
|
+
|
|
53
|
+
### v0.12.0
|
|
54
|
+
|
|
55
|
+
- Allow unfrozen relative and absolute URLs to replace their components.
|
|
56
|
+
|
|
57
|
+
### v0.10.0
|
|
58
|
+
|
|
59
|
+
- Rename `Protocol::URL::FormData::Parser::CONTENT_TYPE` to `MEDIA_TYPE`.
|
|
60
|
+
|
|
61
|
+
### v0.9.0
|
|
62
|
+
|
|
63
|
+
- Add `Protocol::URL::LimitError` for configured processing limits.
|
|
64
|
+
|
|
65
|
+
### v0.8.0
|
|
66
|
+
|
|
67
|
+
- Use consistent limit naming for form data parser constraints.
|
|
68
|
+
|
|
69
|
+
### v0.7.0
|
|
70
|
+
|
|
71
|
+
- Allow `Protocol::URL::FormData::Parser#parse` to populate a supplied result object.
|
|
72
|
+
|
|
73
|
+
### v0.6.0
|
|
74
|
+
|
|
75
|
+
- Add `Protocol::URL::FormData::Parser` for incremental, limited parsing of `application/x-www-form-urlencoded` form data.
|
|
76
|
+
- Add `Protocol::URL::FormData::Nested` for consistently building nested form data while preserving absent and empty values.
|
|
77
|
+
|
|
37
78
|
### v0.15.0
|
|
38
79
|
|
|
39
80
|
- Add `Protocol::URL::Relative#relative_to` for expressing root-relative URLs relative to a base path.
|
data/releases.md
CHANGED
data.tar.gz.sig
CHANGED
|
Binary file
|
metadata
CHANGED
metadata.gz.sig
CHANGED
|
Binary file
|