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

Remove code for special decoding of webdav response. #1520

Merged
merged 1 commit into from
Apr 24, 2024
Merged
Show file tree
Hide file tree
Changes from all 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
15 changes: 1 addition & 14 deletions projects/mercury/src/file/FileAPI.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,7 @@ import {createClient} from 'webdav';
import qs from 'qs';
import {compareBy, comparing} from '../common/utils/genericUtils';
// eslint-disable-next-line import/no-cycle
import {
decodeHTMLEntities,
encodePath,
generateUniqueFileName,
getFileName,
joinPaths,
joinPathsAvoidEmpty
} from './fileUtils';
import {encodePath, generateUniqueFileName, getFileName, joinPaths, joinPathsAvoidEmpty} from './fileUtils';
import {handleHttpError} from '../common/utils/httpUtils';

// Ensure that the client passes along the credentials
Expand Down Expand Up @@ -479,12 +472,6 @@ class FileAPI {
mapToFile = fileObject => {
const properties = {...fileObject, ...(fileObject.props || {})};
delete properties.props;
Object.keys(properties).forEach(key => {
// The WebDAV client does not properly decode the XML response,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let me be honest, I still don't understand this part of the code. Did you check the problem this piece of code solves? Don't we remove a fix of something?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I mean I see your comment, I saw the ticket you created. Does this ticket cover the issue? How critical is it?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That is the thing, it doesn't seem to be solving any problem. Maybe there was something in previous versions of webdav, but now with or without it makes no difference (I tried various properties, various special characters - still no difference if it is there or not)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good, let's indeed remove it and see how it goes

// so we need to do that here
const value = properties[key];
properties[key] = typeof value === 'string' ? decodeHTMLEntities(value) : value;
});
return properties;
};
}
Expand Down
6 changes: 0 additions & 6 deletions projects/mercury/src/file/fileUtils.js
Original file line number Diff line number Diff line change
Expand Up @@ -137,12 +137,6 @@ export function generateUniqueFileName(fileName, usedNames = []) {
return newName;
}

export const decodeHTMLEntities = (htmlSource: string) => {
const element = document.createElement('textarea');
element.innerHTML = htmlSource;
return element.textContent;
};

export const isUnsafeFileName = fileName => NON_SAFE_FILE_NAMES.includes(fileName);

export const fileNameContainsInvalidCharacter = fileName =>
Expand Down
Loading