예제 #1
0
def api_delete_path(path='.'):
    """Return a list of files in a path if permitted
    """
    real_path = protect_path(path)
    try:
        delete_path(real_path)
        return relist_parent_folder(real_path)
    except OSError:
        abort(404)
예제 #2
0
def _delete_shared_path(path='.'):
    """
    We delete .../user/shares/<uid>
    and .../user/config/<path>/<uid>
    """
    uid = basename(path)
    folder = dirname(path)
    abs_folder_path = protect_path(folder)
    config_folder_path = protect_path(path, 'config')
    config_uid_path = protect_path(uid, 'config')
    try:
        delete_path(config_folder_path)
        delete_path(config_uid_path)
        return relist_parent_folder(abs_folder_path)
    except OSError:
        abort(404)
예제 #3
0
def test_delete_path():
    """Delete a file or a folder"""
    t.DEBUG = True
    prep_folder()
    r = t.delete_path("/tmp/test")
    assert r == {"/tmp/test": "deleted"}
    del_folder()