Commit 7ba4745a authored by Matija Obreza's avatar Matija Obreza
Browse files

Fix: Handle /** path parameter properly

parent e57c27a2
......@@ -13,15 +13,15 @@ const URL_REMOVE_FILE = UrlTemplate.parse(`/api/v1/repository/file/{fileUuid}`);
const URL_UPDATE_FILE = `/api/v1/repository/file`;
const URL_MOVE_AND_RENAME_FILE = UrlTemplate.parse(`/api/v1/repository/file/{fileUuid}/move`);
const URL_UPDATE_FOLDER = `/api/v1/repository/folder`;
const URL_GET_FOLDER = UrlTemplate.parse(`/api/v1/repository/folder/{path}`);
const URL_ENSURE_FOLDER = UrlTemplate.parse(`/api/v1/repository/folder/{path}`);
const URL_DELETE_FOLDER = UrlTemplate.parse(`/api/v1/repository/folder/{path}`);
const URL_GET_FOLDER = UrlTemplate.parse(`/api/v1/repository/folder`);
const URL_ENSURE_FOLDER = UrlTemplate.parse(`/api/v1/repository/folder`);
const URL_DELETE_FOLDER = UrlTemplate.parse(`/api/v1/repository/folder`);
const URL_RENAME_FOLDER = UrlTemplate.parse(`/api/v1/repository/folder/{folderUuid}/rename`);
const URL_UPDATE_GALLERY = `/api/v1/repository/gallery`;
const URL_GET_GALLERY = UrlTemplate.parse(`/api/v1/repository/gallery/{path}`);
const URL_CREATE_GALLERY = UrlTemplate.parse(`/api/v1/repository/gallery/{path}`);
const URL_REMOVE_GALLERY = UrlTemplate.parse(`/api/v1/repository/gallery/{path}`);
const URL_UPLOAD_FILE = UrlTemplate.parse(`/api/v1/repository/upload/{path}`);
const URL_GET_GALLERY = UrlTemplate.parse(`/api/v1/repository/gallery`);
const URL_CREATE_GALLERY = UrlTemplate.parse(`/api/v1/repository/gallery`);
const URL_REMOVE_GALLERY = UrlTemplate.parse(`/api/v1/repository/gallery`);
const URL_UPLOAD_FILE = UrlTemplate.parse(`/api/v1/repository/upload`);
/*
* Defined in Swagger as 'repository'
......@@ -120,13 +120,13 @@ class FileRepositoryService {
}
/**
* getFolder at /api/v1/repository/folder/{path}
* getFolder at /api/v1/repository/folder/**
*
* @param path URL path
*/
public static getFolder(path: string): Promise<FolderDetails> {
const apiUrl = URL_GET_FOLDER.expand({path});
const apiUrl = URL_GET_FOLDER.expand({}) + path;
// console.log(`Fetching from ${apiUrl}`);
const content = { /* No content in request body */ };
......@@ -138,13 +138,13 @@ class FileRepositoryService {
}
/**
* ensureFolder at /api/v1/repository/folder/{path}
* ensureFolder at /api/v1/repository/folder/**
*
* @param path URL path
*/
public static ensureFolder(path: string): Promise<RepositoryFolder> {
const apiUrl = URL_ENSURE_FOLDER.expand({path});
const apiUrl = URL_ENSURE_FOLDER.expand({}) + path;
// console.log(`Fetching from ${apiUrl}`);
const content = { /* No content in request body */ };
......@@ -156,13 +156,13 @@ class FileRepositoryService {
}
/**
* deleteFolder at /api/v1/repository/folder/{path}
* deleteFolder at /api/v1/repository/folder/**
*
* @param path URL path
*/
public static deleteFolder(path: string): Promise<RepositoryFolder> {
const apiUrl = URL_DELETE_FOLDER.expand({path});
const apiUrl = URL_DELETE_FOLDER.expand({}) + path;
// console.log(`Fetching from ${apiUrl}`);
const content = { /* No content in request body */ };
......@@ -211,13 +211,13 @@ class FileRepositoryService {
}
/**
* getGallery at /api/v1/repository/gallery/{path}
* getGallery at /api/v1/repository/gallery/**
*
* @param path URL path
*/
public static getGallery(path: string): Promise<ImageGallery> {
const apiUrl = URL_GET_GALLERY.expand({path});
const apiUrl = URL_GET_GALLERY.expand({}) + path;
// console.log(`Fetching from ${apiUrl}`);
const content = { /* No content in request body */ };
......@@ -229,14 +229,14 @@ class FileRepositoryService {
}
/**
* createGallery at /api/v1/repository/gallery/{path}
* createGallery at /api/v1/repository/gallery/**
*
* @param path URL path
* @param metadata metadata
*/
public static createGallery(path: string, metadata: ImageGallery): Promise<ImageGallery> {
const apiUrl = URL_CREATE_GALLERY.expand({path});
const apiUrl = URL_CREATE_GALLERY.expand({}) + path;
// console.log(`Fetching from ${apiUrl}`);
const content = { data: metadata };
......@@ -248,13 +248,13 @@ class FileRepositoryService {
}
/**
* removeGallery at /api/v1/repository/gallery/{path}
* removeGallery at /api/v1/repository/gallery/**
*
* @param path URL path
*/
public static removeGallery(path: string): Promise<ImageGallery> {
const apiUrl = URL_REMOVE_GALLERY.expand({path});
const apiUrl = URL_REMOVE_GALLERY.expand({}) + path;
// console.log(`Fetching from ${apiUrl}`);
const content = { /* No content in request body */ };
......@@ -266,7 +266,7 @@ class FileRepositoryService {
}
/**
* uploadFile at /api/v1/repository/upload/{path}
* uploadFile at /api/v1/repository/upload/**
*
* @param path URL path
* @param file file
......@@ -277,7 +277,7 @@ class FileRepositoryService {
const qs = QueryString.stringify({
metadata: metadata || undefined,
}, {});
const apiUrl = URL_UPLOAD_FILE.expand({path}) + (qs ? `?${qs}` : '');
const apiUrl = URL_UPLOAD_FILE.expand({}) + path + (qs ? `?${qs}` : '');
// console.log(`Fetching from ${apiUrl}`);
const content = { /* No content in request body */ };
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment