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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 1d1384cd7ea74826bb5dc6e145fb09c9573c807fdac7d2297164317b6caf5645
4
- data.tar.gz: 4d4b5100c8aca8008c3be18ad9f4b79139c00251f711283a90432179e292c941
3
+ metadata.gz: 19ab80e6eb5272f7866b22b006ff4803adefdaa8913f35a81c8f1b79b0e60de6
4
+ data.tar.gz: 525c3a31f539f9250dab7a33e069785132ae7d86e0e1789e02dc1e9c0447d4c1
5
5
  SHA512:
6
- metadata.gz: f284536c31a02466b10821c12bb1a4529a023d789cafbdfae10dd71d8f3049d78f0a0dbc03f8255f3ebdb0b7278eeccd38ca81baf480e116b6fe2a4b72a0bf22
7
- data.tar.gz: 4ae5bb2749190910c76193b6c451b47b4bbcacaded41002cc54713dc219638e4966f4522f9df2e20a7f04e1e89ab2c09c6df1497bf849afe9a202fb7ad5ceacf
6
+ metadata.gz: 272e4b1d19ae57a938e2407b77f5d2f2f8df65df57bd7651459ccb104c8d52e4d8a765a8d4a4462ea2f0b365bbd2b6bde6dfe4b77ad005caf6f3ff2910757e77
7
+ data.tar.gz: 7c73a1a644c936e64c41d5c9c578dbee3b08eb9b1e735bc57ffe32b7193ef7edd43a28504ac9b8e600f1904365621059b4a2dd9f7398c81c897da925e7741a18
checksums.yaml.gz.sig CHANGED
Binary file
@@ -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
 
@@ -7,6 +7,6 @@
7
7
  module Protocol
8
8
  # @namespace
9
9
  module URL
10
- VERSION = "0.15.0"
10
+ VERSION = "0.16.0"
11
11
  end
12
12
  end
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
@@ -1,5 +1,9 @@
1
1
  # Releases
2
2
 
3
+ ## v0.16.0
4
+
5
+ - Preserve directory and file semantics when generating relative URL paths.
6
+
3
7
  ## v0.15.0
4
8
 
5
9
  - Add `Protocol::URL::Relative#relative_to` for expressing root-relative URLs relative to a base path.
data.tar.gz.sig CHANGED
Binary file
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: protocol-url
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.15.0
4
+ version: 0.16.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Samuel Williams
metadata.gz.sig CHANGED
Binary file