url icon indicating copy to clipboard operation
url copied to clipboard

Relative path

Open alandefreitas opened this issue 2 years ago • 22 comments

fix #407

alandefreitas avatar Aug 18 '22 16:08 alandefreitas

An automated preview of the documentation is available at https://425.url.prtest.cppalliance.org/libs/url/doc/html/index.html

cppalliance-bot avatar Aug 18 '22 16:08 cppalliance-bot

quite a lot here !

vinniefalco avatar Aug 18 '22 16:08 vinniefalco

Codecov Report

Merging #425 (579deee) into develop (afb91bc) will decrease coverage by 0.07%. The diff coverage is 98.75%.

:exclamation: Current head 579deee differs from pull request most recent head f9c5121. Consider uploading reports for the commit f9c5121 to get more accurate results

Impacted file tree graph

@@             Coverage Diff             @@
##           develop     #425      +/-   ##
===========================================
- Coverage    97.92%   97.84%   -0.08%     
===========================================
  Files          132      132              
  Lines         6349     6494     +145     
===========================================
+ Hits          6217     6354     +137     
- Misses         132      140       +8     
Impacted Files Coverage Δ
include/boost/url/url.hpp 100.00% <ø> (ø)
include/boost/url/impl/url.ipp 97.04% <98.11%> (+1.80%) :arrow_up:
include/boost/url/authority_view.hpp 94.87% <100.00%> (+0.58%) :arrow_up:
include/boost/url/impl/authority_view.ipp 96.77% <100.00%> (+2.03%) :arrow_up:
include/boost/url/impl/url_base.ipp 98.87% <100.00%> (ø)
include/boost/url/impl/url_view_base.ipp 98.56% <100.00%> (-1.44%) :arrow_down:
include/boost/url/url_view_base.hpp 100.00% <100.00%> (ø)
include/boost/url/detail/impl/normalize.ipp 97.46% <0.00%> (-1.90%) :arrow_down:

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update afb91bc...f9c5121. Read the comment docs.

codecov[bot] avatar Aug 18 '22 17:08 codecov[bot]

An automated preview of the documentation is available at https://425.url.prtest.cppalliance.org/libs/url/doc/html/index.html

cppalliance-bot avatar Aug 18 '22 20:08 cppalliance-bot

quite a lot here !

Yes. This function seems useful. The PR was also useful to find lots of small bugs and features missing here and there. Like some problems with the url_base::ops and set_path(""). It also gave me some ideas to improve that noexcept path comparison we have in url_view::compare.

Some other questions that came up:

  • About the order of arguments: std::filesystem/boost::filesystem functions use relative(const path&, const path& base). Also absolute, proximate, etc. It does look more natural. Shouldn't we do the same here to relative/absolute/resolve?

  • The basic exception guarantee is not satisfied in case of allocation errors after the first allocation. Is that a problem?

alandefreitas avatar Aug 18 '22 21:08 alandefreitas

Oh... look what URI.js says about absoluteTo:

https://github.com/medialize/URI.js/blob/28976cde5bb32a433ab78c4a32ef58f39d2cabf6/test/test.js#L1479

So we only need resolve and relative.

alandefreitas avatar Aug 18 '22 21:08 alandefreitas

An automated preview of the documentation is available at https://425.url.prtest.cppalliance.org/libs/url/doc/html/index.html

cppalliance-bot avatar Aug 18 '22 23:08 cppalliance-bot

An automated preview of the documentation is available at https://425.url.prtest.cppalliance.org/libs/url/doc/html/index.html

cppalliance-bot avatar Aug 19 '22 20:08 cppalliance-bot

I fixed the last test that was failing:

check("/../path/x/../to/y/../somewhere/else", "/a/../../path/to/a", "../a");

This function had a problem similar to op==: comparing paths without a stack. The difference is we need the longest common path instead.

As usual, I tried many solutions and realized comparing the segments in reverse is the only solution with linear cost. Because of how hard this is and so we can move on, I used the other solution which could be n^2 in a very edgy case.

alandefreitas avatar Aug 19 '22 21:08 alandefreitas

An automated preview of the documentation is available at https://425.url.prtest.cppalliance.org/libs/url/doc/html/index.html

cppalliance-bot avatar Aug 19 '22 21:08 cppalliance-bot

An automated preview of the documentation is available at https://425.url.prtest.cppalliance.org/libs/url/doc/html/index.html

cppalliance-bot avatar Aug 19 '22 21:08 cppalliance-bot

An automated preview of the documentation is available at https://425.url.prtest.cppalliance.org/libs/url/doc/html/index.html

cppalliance-bot avatar Aug 24 '22 19:08 cppalliance-bot

we can use temporary memory with recycled_ptr now if it will simplify and speed up the algorithm

vinniefalco avatar Aug 25 '22 14:08 vinniefalco

An automated preview of the documentation is available at https://425.url.prtest.cppalliance.org/libs/url/doc/html/index.html

cppalliance-bot avatar Aug 26 '22 19:08 cppalliance-bot

An automated preview of the documentation is available at https://425.url.prtest.cppalliance.org/libs/url/doc/html/index.html

cppalliance-bot avatar Aug 26 '22 21:08 cppalliance-bot

An automated preview of the documentation is available at https://425.url.prtest.cppalliance.org/libs/url/doc/html/index.html

cppalliance-bot avatar Aug 26 '22 22:08 cppalliance-bot

An automated preview of the documentation is available at https://425.url.prtest.cppalliance.org/libs/url/doc/html/index.html

cppalliance-bot avatar Sep 07 '22 21:09 cppalliance-bot

An automated preview of the documentation is available at https://425.url.prtest.cppalliance.org/libs/url/doc/html/index.html

cppalliance-bot avatar Sep 09 '22 19:09 cppalliance-bot

An automated preview of the documentation is available at https://425.url.prtest.cppalliance.org/libs/url/doc/html/index.html

cppalliance-bot avatar Sep 14 '22 22:09 cppalliance-bot

An automated preview of the documentation is available at https://425.url.prtest.cppalliance.org/libs/url/doc/html/index.html

cppalliance-bot avatar Sep 14 '22 22:09 cppalliance-bot

I rebased this PR and fixed everything that broke with the new containers.

alandefreitas avatar Sep 14 '22 22:09 alandefreitas

Codecov Report

Merging #425 (559dc25) into develop (ecdc8f1) will increase coverage by 0.01%. The diff coverage is 98.88%.

Additional details and impacted files

Impacted file tree graph

@@             Coverage Diff             @@
##           develop     #425      +/-   ##
===========================================
+ Coverage    96.81%   96.83%   +0.01%     
===========================================
  Files          139      139              
  Lines         6691     6847     +156     
===========================================
+ Hits          6478     6630     +152     
- Misses         213      217       +4     
Impacted Files Coverage Δ
include/boost/url/url.hpp 100.00% <ø> (ø)
include/boost/url/impl/url_base.ipp 98.95% <98.19%> (-0.08%) :arrow_down:
include/boost/url/authority_view.hpp 94.59% <100.00%> (+0.65%) :arrow_up:
include/boost/url/impl/authority_view.ipp 84.17% <100.00%> (+5.31%) :arrow_up:
include/boost/url/impl/url_view_base.ipp 98.60% <100.00%> (+<0.01%) :arrow_up:
include/boost/url/url_base.hpp 100.00% <100.00%> (ø)
include/boost/url/detail/impl/normalize.ipp 97.46% <0.00%> (-1.90%) :arrow_down:

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update ecdc8f1...559dc25. Read the comment docs.

codecov[bot] avatar Sep 14 '22 22:09 codecov[bot]

An automated preview of the documentation is available at https://425.url.prtest.cppalliance.org/libs/url/doc/html/index.html

cppalliance-bot avatar Oct 05 '22 15:10 cppalliance-bot

An automated preview of the documentation is available at https://425.url.prtest.cppalliance.org/libs/url/doc/html/index.html

cppalliance-bot avatar Oct 12 '22 23:10 cppalliance-bot

An automated preview of the documentation is available at https://425.url.prtest.cppalliance.org/libs/url/doc/html/index.html

cppalliance-bot avatar Oct 19 '22 23:10 cppalliance-bot