diff --git a/artifactory.py b/artifactory.py
index 3b14d4f..079b7c4 100755
--- a/artifactory.py
+++ b/artifactory.py
@@ -358,11 +358,16 @@ class _ArtifactoryFlavour(pathlib._Flavour):
             parts = part.split(mark)
         else:
             url = urllib3.util.parse_url(part)
+
+            if (without_http_prefix(part).strip("/") == part.strip("/") and
+                    url.path and not url.path.strip("/").startswith("artifactory")):
+                return '', '', part
+
             if url.path is None or url.path == sep:
                 if url.scheme:
                     return part.rstrip(sep), '', ''
                 return '', '', part
-            elif 'artifactory' in url.path:
+            elif url.path.lstrip("/").startswith("artifactory"):
                 mark = sep + 'artifactory' + sep
                 parts = part.split(mark)
             else:

/ operator on ArtifactoryPath fails if string contains "/"
Maybe linked to #31.

```python
>>> arti = Artifactory("http://my.artifactory.ext/artifactory")
>>> arti
ArtifactoryPath('http://my.artifactory.ext/artifactory')
>>> arti / "foo"
ArtifactoryPath('http://my.artifactory.ext/artifactory/foo')
>>> arti / "foo" / "bar"
ArtifactoryPath('http://my.artifactory.ext/artifactory/foo/bar')
>>> arti / "foo/bar"
ArtifactoryPath('foo/bar/')  # expected: http://my.artifactory.ext/artifactory/foo/bar
```
diff --git a/tests/unit/test_artifactory_path.py b/tests/unit/test_artifactory_path.py
index 0460d7f..8fd13d9 100644
--- a/tests/unit/test_artifactory_path.py
+++ b/tests/unit/test_artifactory_path.py
@@ -88,6 +88,9 @@ class ArtifactoryFlavorTest(unittest.TestCase):
               ('http://artifactory.local/artifactory', '/foo/', 'bar'))
         check("https://artifactory.a.b.c.d/artifactory/foo/bar",
               ('https://artifactory.a.b.c.d/artifactory', '/foo/', 'bar'))
+        check("https://artifactory.a.b.c.d/artifactory/foo/artifactory/bar",
+              ('https://artifactory.a.b.c.d/artifactory', '/foo/',
+               'artifactory/bar'))
 
     def test_splitroot_custom_drv(self):
         """
@@ -119,6 +122,8 @@ class ArtifactoryFlavorTest(unittest.TestCase):
               ('https://artifacts.example.com', '/root/', 'parts'))
         check("https://artifacts.example.com/root/parts/",
               ('https://artifacts.example.com', '/root/', 'parts'))
+        check("https://artifacts.example.com/root/artifactory/parts/",
+              ('https://artifacts.example.com', '/root/', 'artifactory/parts'))
 
     def test_splitroot_custom_root(self):
         check = self._check_splitroot
@@ -137,6 +142,8 @@ class ArtifactoryFlavorTest(unittest.TestCase):
               ('http://custom/root', '/foo/', 'bar'))
         check("https://custom/root/foo/baz",
               ('https://custom/root', '/foo/', 'baz'))
+        check("https://custom/root/foo/with/artifactory/folder/baz",
+              ('https://custom/root', '/foo/', 'with/artifactory/folder/baz'))
 
     def test_parse_parts(self):
         check = self._check_parse_parts
@@ -160,6 +167,11 @@ class ArtifactoryFlavorTest(unittest.TestCase):
               ('http://example.com/artifactory', '/foo/',
                ['http://example.com/artifactory/foo/', 'bar', 'artifactory']))
 
+        check(['http://example.com/artifactory/foo/bar/artifactory/fi'],
+              ('http://example.com/artifactory', '/foo/',
+               ['http://example.com/artifactory/foo/', 'bar', 'artifactory',
+                'fi']))
+
 
 class PureArtifactoryPathTest(unittest.TestCase):
     cls = artifactory.PureArtifactoryPath
@@ -225,6 +237,23 @@ class PureArtifactoryPathTest(unittest.TestCase):
         c = b / "path.txt"
         self.assertEqual(str(c), "http://b/artifactory/reponame/f/path.txt")
 
+    def test_join_with_artifactory_folder(self):
+        P = self.cls
+
+        b = P("http://b/artifactory/reponame/path/with/artifactory/folder")
+        c = b / "path.txt"
+        self.assertEqual(str(c), "http://b/artifactory/reponame/path/with/artifactory/folder/path.txt")
+
+    def test_join_with_multiple_folder_and_artifactory_substr_in_it(self):
+        """
+        https://github.com/devopshq/artifactory/issues/58
+        """
+        P = self.cls
+
+        b = P("http://b/artifactory/reponame")
+        c = b / "path/with/multiple/subdir/and/artifactory/path.txt"
+        self.assertEqual(str(c), "http://b/artifactory/reponame/path/with/multiple/subdir/and/artifactory/path.txt")
+
 
 class ArtifactoryAccessorTest(unittest.TestCase):
     """ Test the real artifactory integration """

pip install -e .[dev]
parse_log_pytest
requirements.txt
pytest
3.9
requirements-dev.txt
pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning
certifi==2025.1.31
charset-normalizer==3.4.1
-e git+https://github.com/devopshq/artifactory.git@9813bc6d86e7ede9dc395dbfeaf7f5e02030f29c#egg=dohq_artifactory
exceptiongroup==1.2.2
flake8==7.2.0
idna==3.10
iniconfig==2.1.0
mccabe==0.7.0
mock==5.2.0
packaging==24.2
pathlib==1.0.1
pluggy==1.5.0
pycodestyle==2.13.0
pyflakes==3.3.2
pytest==8.3.5
python-dateutil==2.9.0.post0
requests==2.32.3
six==1.17.0
tomli==2.2.1
urllib3==2.3.0

name: artifactory
channels:
  - defaults
  - https://repo.anaconda.com/pkgs/main
  - https://repo.anaconda.com/pkgs/r
  - conda-forge
dependencies:
  - _libgcc_mutex=0.1=main
  - _openmp_mutex=5.1=1_gnu
  - ca-certificates=2025.2.25=h06a4308_0
  - ld_impl_linux-64=2.40=h12ee557_0
  - libffi=3.4.4=h6a678d5_1
  - libgcc-ng=11.2.0=h1234567_1
  - libgomp=11.2.0=h1234567_1
  - libstdcxx-ng=11.2.0=h1234567_1
  - ncurses=6.4=h6a678d5_0
  - openssl=3.0.16=h5eee18b_0
  - pip=25.0=py39h06a4308_0
  - python=3.9.21=he870216_1
  - readline=8.2=h5eee18b_0
  - setuptools=75.8.0=py39h06a4308_0
  - sqlite=3.45.3=h5eee18b_0
  - tk=8.6.14=h39e8969_0
  - tzdata=2025a=h04d1e81_0
  - wheel=0.45.1=py39h06a4308_0
  - xz=5.6.4=h5eee18b_1
  - zlib=1.2.13=h5eee18b_1
  - pip:
      - certifi==2025.1.31
      - charset-normalizer==3.4.1
      - exceptiongroup==1.2.2
      - flake8==7.2.0
      - idna==3.10
      - iniconfig==2.1.0
      - mccabe==0.7.0
      - mock==5.2.0
      - packaging==24.2
      - pathlib==1.0.1
      - pluggy==1.5.0
      - pycodestyle==2.13.0
      - pyflakes==3.3.2
      - pytest==8.3.5
      - python-dateutil==2.9.0.post0
      - requests==2.32.3
      - six==1.17.0
      - tomli==2.2.1
      - urllib3==2.3.0
prefix: /opt/conda/envs/artifactory

tests/unit/test_artifactory_path.py::ArtifactoryFlavorTest::test_splitroot_custom_drv tests/unit/test_artifactory_path.py::PureArtifactoryPathTest::test_join_with_multiple_folder_and_artifactory_substr_in_it
tests/unit/test_artifactory_path.py::UtilTest::test_escape_chars tests/unit/test_artifactory_path.py::UtilTest::test_matrix_encode tests/unit/test_artifactory_path.py::UtilTest::test_properties_encode tests/unit/test_artifactory_path.py::UtilTest::test_properties_encode_multi tests/unit/test_artifactory_path.py::ArtifactoryFlavorTest::test_parse_parts tests/unit/test_artifactory_path.py::ArtifactoryFlavorTest::test_splitroot tests/unit/test_artifactory_path.py::ArtifactoryFlavorTest::test_splitroot_custom_root tests/unit/test_artifactory_path.py::PureArtifactoryPathTest::test_anchor tests/unit/test_artifactory_path.py::PureArtifactoryPathTest::test_join_endswith_slash tests/unit/test_artifactory_path.py::PureArtifactoryPathTest::test_join_endswithout_slash tests/unit/test_artifactory_path.py::PureArtifactoryPathTest::test_join_with_artifactory_folder tests/unit/test_artifactory_path.py::PureArtifactoryPathTest::test_join_with_repo tests/unit/test_artifactory_path.py::PureArtifactoryPathTest::test_join_with_repo_folder tests/unit/test_artifactory_path.py::PureArtifactoryPathTest::test_root tests/unit/test_artifactory_path.py::PureArtifactoryPathTest::test_with_suffix tests/unit/test_artifactory_path.py::ArtifactoryAccessorTest::test_deploy tests/unit/test_artifactory_path.py::ArtifactoryAccessorTest::test_get_properties tests/unit/test_artifactory_path.py::ArtifactoryAccessorTest::test_listdir tests/unit/test_artifactory_path.py::ArtifactoryAccessorTest::test_mkdir tests/unit/test_artifactory_path.py::ArtifactoryAccessorTest::test_set_properties tests/unit/test_artifactory_path.py::ArtifactoryAccessorTest::test_set_properties_without_remove tests/unit/test_artifactory_path.py::ArtifactoryAccessorTest::test_stat tests/unit/test_artifactory_path.py::ArtifactoryPathTest::test_auth tests/unit/test_artifactory_path.py::ArtifactoryPathTest::test_auth_inheritance tests/unit/test_artifactory_path.py::ArtifactoryPathTest::test_basic tests/unit/test_artifactory_path.py::ArtifactoryPathTest::test_path_in_repo tests/unit/test_artifactory_path.py::ArtifactoryPathTest::test_repo tests/unit/test_artifactory_path.py::TestArtifactoryConfig::test_artifactory_config tests/unit/test_artifactory_path.py::TestArtifactoryAql::test_create_aql_text_list tests/unit/test_artifactory_path.py::TestArtifactoryAql::test_create_aql_text_list_in_dict tests/unit/test_artifactory_path.py::TestArtifactoryAql::test_create_aql_text_simple tests/unit/test_artifactory_path.py::TestArtifactoryAql::test_from_aql_file
artifactory.py
artifactory.py