Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handle international characters in remote HS paths #442

Merged
merged 3 commits into from
Feb 23, 2021
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion packages/cli-lib/api/fileMapper.js
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ async function downloadDefault(accountId, filepath, options = {}) {
*/
async function deleteFile(accountId, filePath, options = {}) {
return http.delete(accountId, {
uri: `${FILE_MAPPER_API_PATH}/delete/${filePath}`,
uri: `${FILE_MAPPER_API_PATH}/delete/${encodeURIComponent(filePath)}`,
...options,
});
}
Expand Down
4 changes: 3 additions & 1 deletion packages/cli/commands/remove.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ const {
const { logDebugInfo } = require('../lib/debugInfo');
const { validateAccount } = require('../lib/validation');
const { trackCommandUsage } = require('../lib/usageTracking');
const { convertToUnixPath } = require('@hubspot/cli-lib/path');

exports.command = 'remove <path>';
exports.describe = 'Delete a file or folder from HubSpot';
Expand All @@ -40,7 +41,8 @@ exports.handler = async options => {
trackCommandUsage('remove', {}, accountId);

try {
await deleteFile(accountId, hsPath);
let unixPath = convertToUnixPath(hsPath);
lars-erik marked this conversation as resolved.
Show resolved Hide resolved
await deleteFile(accountId, unixPath);
logger.log(`Deleted "${hsPath}" from account ${accountId}`);
} catch (error) {
logger.error(`Deleting "${hsPath}" from account ${accountId} failed`);
Expand Down