# Path: pgcontents/error.py
# class CorruptedFile(Exception):
#     pass
# 
# class PathOutsideRoot(Exception):
#     pass
# 
# Path: pgcontents/utils/ipycompat.py



from base64 import (
    b64decode,
    b64encode,
)
from datetime import datetime
from functools import wraps
from tornado.web import HTTPError
from .error import CorruptedFile, PathOutsideRoot
from .utils.ipycompat import reads, writes
import mimetypes
import posixpath
        "mimetype": None,
    }


def base_directory_model(path):
    m = base_model(path)
    m.update(
        type='directory',
        last_modified=DUMMY_CREATED_DATE,
        created=DUMMY_CREATED_DATE,
    )
    return m


def api_path_join(*paths):
    """
    Join API-style paths.
    """
    return posixpath.join(*paths).strip('/')


def normalize_api_path(api_path):
    """
    Resolve paths with '..' to normalized paths, raising an error if the final
    result is outside root.
    """
    normalized = posixpath.normpath(api_path.strip('/'))
    if normalized == '.':
        normalized = ''
    elif normalized.startswith('..'):

# Path: pgcontents/error.py
# class CorruptedFile(Exception):
#     pass
# 
# class PathOutsideRoot(Exception):
#     pass
# 
# Path: pgcontents/utils/ipycompat.py



# Path: pgcontents/api_utils.py
from base64 import (
    b64decode,
    b64encode,
)
from datetime import datetime
from functools import wraps
from tornado.web import HTTPError
from .error import CorruptedFile, PathOutsideRoot
from .utils.ipycompat import reads, writes
import mimetypes
import posixpath

        "mimetype": None,
    }


def base_directory_model(path):
    m = base_model(path)
    m.update(
        type='directory',
        last_modified=DUMMY_CREATED_DATE,
        created=DUMMY_CREATED_DATE,
    )
    return m


def api_path_join(*paths):
    """
    Join API-style paths.
    """
    return posixpath.join(*paths).strip('/')


def normalize_api_path(api_path):
    """
    Resolve paths with '..' to normalized paths, raising an error if the final
    result is outside root.
    """
    normalized = posixpath.normpath(api_path.strip('/'))
    if normalized == '.':
        normalized = ''
    elif normalized.startswith('..'):

        raise PathOutsideRoot(normalized)