Exemple #1
0
 def _is_in_basedir(self, local_path):
     return any(
         path.is_path_inside_base_dir(
             local_path, media_dir['path'].encode('utf-8'))
         for media_dir in self._media_dirs)
Exemple #2
0
 def test_when_outside(self):
     assert not path.is_path_inside_base_dir("/æ/øå", "/ø")
Exemple #3
0
 def test_str_inside_byte_does_not_fail(self):
     assert path.is_path_inside_base_dir("/æ/øå", "/æ".encode())
Exemple #4
0
 def test_str_inside_str_fails(self):
     with pytest.raises(ValueError):
         path.is_path_inside_base_dir('/æ/øå', '/æ')
Exemple #5
0
 def test_when_inside(self):
     assert path.is_path_inside_base_dir("/æ/øå", "/æ")
Exemple #6
0
 def test_str_inside_byte_fails(self):
     with pytest.raises(ValueError):
         path.is_path_inside_base_dir('/æ/øå', '/æ'.encode('utf-8'))
Exemple #7
0
 def test_when_outside(self):
     assert not path.is_path_inside_base_dir(
         '/æ/øå'.encode('utf-8'),
         '/ø'.encode('utf-8'))
Exemple #8
0
 def _is_in_basedir(self, local_path):
     return any(
         path.is_path_inside_base_dir(local_path, media_dir["path"])
         for media_dir in self._media_dirs)
Exemple #9
0
 def _is_in_basedir(self, local_path):
     return any(
         path.is_path_inside_base_dir(local_path, media_dir['path'].encode(
             'utf-8')) for media_dir in self._media_dirs)
Exemple #10
0
 def _is_in_basedir(self, local_path):
     if not os.path.isabs(local_path):
         local_path = os.path.join(self._playlists_dir, local_path)
     return path.is_path_inside_base_dir(local_path, self._playlists_dir)