Skip to content

Commit

Permalink
Merge pull request #96 from internxt/fix/folder-names-and-file-creation
Browse files Browse the repository at this point in the history
fix: fix folder names and file creation
  • Loading branch information
ldandradesw authored Aug 20, 2024
2 parents 8cd6e81 + 7789fe0 commit eda3796
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 21 deletions.
28 changes: 14 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ $ npm install -g @internxt/cli
$ internxt COMMAND
running command...
$ internxt (--version)
@internxt/cli/1.2.1 darwin-arm64 node-v20.14.0
@internxt/cli/1.2.2 darwin-arm64 node-v20.14.0
$ internxt --help [COMMAND]
USAGE
$ internxt COMMAND
Expand Down Expand Up @@ -71,7 +71,7 @@ EXAMPLES
$ internxt add-cert
```

_See code: [src/commands/add-cert.ts](https://github.com/internxt/cli/blob/v1.2.1/src/commands/add-cert.ts)_
_See code: [src/commands/add-cert.ts](https://github.com/internxt/cli/blob/v1.2.2/src/commands/add-cert.ts)_

## `internxt config`

Expand Down Expand Up @@ -100,7 +100,7 @@ EXAMPLES
$ internxt config
```

_See code: [src/commands/config.ts](https://github.com/internxt/cli/blob/v1.2.1/src/commands/config.ts)_
_See code: [src/commands/config.ts](https://github.com/internxt/cli/blob/v1.2.2/src/commands/config.ts)_

## `internxt create-folder`

Expand All @@ -121,7 +121,7 @@ EXAMPLES
$ internxt create-folder
```

_See code: [src/commands/create-folder.ts](https://github.com/internxt/cli/blob/v1.2.1/src/commands/create-folder.ts)_
_See code: [src/commands/create-folder.ts](https://github.com/internxt/cli/blob/v1.2.2/src/commands/create-folder.ts)_

## `internxt download`

Expand All @@ -144,7 +144,7 @@ EXAMPLES
$ internxt download
```

_See code: [src/commands/download.ts](https://github.com/internxt/cli/blob/v1.2.1/src/commands/download.ts)_
_See code: [src/commands/download.ts](https://github.com/internxt/cli/blob/v1.2.2/src/commands/download.ts)_

## `internxt list`

Expand Down Expand Up @@ -178,7 +178,7 @@ EXAMPLES
$ internxt list
```

_See code: [src/commands/list.ts](https://github.com/internxt/cli/blob/v1.2.1/src/commands/list.ts)_
_See code: [src/commands/list.ts](https://github.com/internxt/cli/blob/v1.2.2/src/commands/list.ts)_

## `internxt login`

Expand All @@ -204,7 +204,7 @@ EXAMPLES
$ internxt login
```

_See code: [src/commands/login.ts](https://github.com/internxt/cli/blob/v1.2.1/src/commands/login.ts)_
_See code: [src/commands/login.ts](https://github.com/internxt/cli/blob/v1.2.2/src/commands/login.ts)_

## `internxt logout`

Expand All @@ -221,7 +221,7 @@ EXAMPLES
$ internxt logout
```

_See code: [src/commands/logout.ts](https://github.com/internxt/cli/blob/v1.2.1/src/commands/logout.ts)_
_See code: [src/commands/logout.ts](https://github.com/internxt/cli/blob/v1.2.2/src/commands/logout.ts)_

## `internxt logs`

Expand All @@ -238,7 +238,7 @@ EXAMPLES
$ internxt logs
```

_See code: [src/commands/logs.ts](https://github.com/internxt/cli/blob/v1.2.1/src/commands/logs.ts)_
_See code: [src/commands/logs.ts](https://github.com/internxt/cli/blob/v1.2.2/src/commands/logs.ts)_

## `internxt move`

Expand All @@ -263,7 +263,7 @@ EXAMPLES
$ internxt move
```

_See code: [src/commands/move.ts](https://github.com/internxt/cli/blob/v1.2.1/src/commands/move.ts)_
_See code: [src/commands/move.ts](https://github.com/internxt/cli/blob/v1.2.2/src/commands/move.ts)_

## `internxt trash`

Expand All @@ -287,7 +287,7 @@ EXAMPLES
$ internxt trash
```

_See code: [src/commands/trash.ts](https://github.com/internxt/cli/blob/v1.2.1/src/commands/trash.ts)_
_See code: [src/commands/trash.ts](https://github.com/internxt/cli/blob/v1.2.2/src/commands/trash.ts)_

## `internxt upload`

Expand All @@ -311,7 +311,7 @@ EXAMPLES
$ internxt upload
```

_See code: [src/commands/upload.ts](https://github.com/internxt/cli/blob/v1.2.1/src/commands/upload.ts)_
_See code: [src/commands/upload.ts](https://github.com/internxt/cli/blob/v1.2.2/src/commands/upload.ts)_

## `internxt webdav ACTION`

Expand All @@ -334,7 +334,7 @@ EXAMPLES
$ internxt webdav status
```

_See code: [src/commands/webdav.ts](https://github.com/internxt/cli/blob/v1.2.1/src/commands/webdav.ts)_
_See code: [src/commands/webdav.ts](https://github.com/internxt/cli/blob/v1.2.2/src/commands/webdav.ts)_

## `internxt whoami`

Expand All @@ -351,7 +351,7 @@ EXAMPLES
$ internxt whoami
```

_See code: [src/commands/whoami.ts](https://github.com/internxt/cli/blob/v1.2.1/src/commands/whoami.ts)_
_See code: [src/commands/whoami.ts](https://github.com/internxt/cli/blob/v1.2.2/src/commands/whoami.ts)_
<!-- commandsstop -->

# Current Limitations
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"author": "PixoDev",
"version": "1.2.1",
"version": "1.2.2",
"description": "Internxt CLI to manage your encrypted storage",
"scripts": {
"build": "tsc",
Expand Down
4 changes: 2 additions & 2 deletions src/utils/webdav.utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ export class WebDavUtils {
req: Request,
driveDatabaseManager: DriveDatabaseManager,
): Promise<WebDavRequestedResource> {
const decodedUrl = decodeURI(req.url);
const decodedUrl = decodeURIComponent(req.url);
const parsedPath = path.parse(decodedUrl);

let isFolder = req.url.endsWith('/');
Expand All @@ -38,7 +38,7 @@ export class WebDavUtils {
return {
url: decodedUrl,
type: 'folder',
name: parsedPath.name,
name: parsedPath.base,
path: parsedPath,
};
} else {
Expand Down
5 changes: 2 additions & 3 deletions src/webdav/handlers/MKCOL.handler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,8 @@ export class MKCOLRequestHandler implements WebDavMethodHandler {

handle = async (req: Request, res: Response) => {
const { driveDatabaseManager, driveFolderService } = this.dependencies;
const decodedUrl = decodeURI(req.url);
const decodedUrl = decodeURIComponent(req.url);
const resourceParsedPath = path.parse(decodedUrl);

const parentPath = WebDavUtils.getParentPath(decodedUrl);

const parentResource = await driveDatabaseManager.findByRelativePath(parentPath);
Expand All @@ -34,7 +33,7 @@ export class MKCOLRequestHandler implements WebDavMethodHandler {
webdavLogger.info(`Parent path: ${parentResource.id}`);

const [createFolder] = driveFolderService.createFolder({
folderName: resourceParsedPath.name,
folderName: resourceParsedPath.base,
parentFolderId: parentResource.id,
});

Expand Down
2 changes: 1 addition & 1 deletion src/webdav/handlers/PUT.handler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ export class PUTRequestHandler implements WebDavMethodHandler {

webdavLogger.info('✅ File uploaded to internxt drive');

this.dependencies.driveDatabaseManager.createFile(file);
await this.dependencies.driveDatabaseManager.createFile(file);

res.status(200);
res.send();
Expand Down

0 comments on commit eda3796

Please sign in to comment.