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 "extension" from AJAX results #106

Closed
dereks opened this issue Feb 12, 2017 · 2 comments
Closed

Remove "extension" from AJAX results #106

dereks opened this issue Feb 12, 2017 · 2 comments
Assignees
Milestone

Comments

@dereks
Copy link
Contributor

dereks commented Feb 12, 2017

Currently the JSON returned by the server contains an attributes member called extension for every file entry:

"extension":"txt",

This is a calculated, redundant value that can be extracted from attributes.name. The Javascript already calculates extensions with a function called getExtension() for other purposes.

To normalize the response data, guarantee consistency, reduce code size, and reduce response size, we could eliminate this member. There are nine references to resourceObject.attributes.extension that would be replaced in the JS. For example:

if(getExtension(file.name) != resourceObject.attributes.extension) {
	fm.error(lg.ERROR_REPLACING_FILE + " ." + resourceObject.attributes.extension);
	return false;
}

...becomes...

if(getExtension(file.name) != getExtension(resourceObject.attributes.name)) {
	fm.error(lg.ERROR_REPLACING_FILE + " ." + getExtension(resourceObject.attributes.name));
	return false;
}

This is a low-priority issue that I would consider minor code cleanup. I'd be happy to submit a Pull Request if you approve of this change. Thanks!

@psolom
Copy link
Owner

psolom commented Feb 12, 2017

Thanks for the suggestion.
Ok, but let's postpone this modification for a bit.
I don't want to change any things related to the connector at the moment. A dependent code is going to be committed soon.

@psolom
Copy link
Owner

psolom commented May 7, 2017

Released in v2.4.0

@psolom psolom closed this as completed May 7, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants