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

make be able to add more than one endpoint to engine service #169

Merged
merged 1 commit into from
Jun 11, 2019

Conversation

yoh1496
Copy link
Contributor

@yoh1496 yoh1496 commented Jun 5, 2019

#156

I modified erroneous regexp in registerFileAsService.prototype.getEngineSubject function .

registerFileAsService.prototype.getEngineSubject = function() {
var path = uBoxProperty.getPath();
var cellName = sessionStorage.selectedcell;
var boxName = sessionStorage.boxName;
var baseUrl = getClientStore().baseURL;
var accessor = objCommon.initializeAccessor(baseUrl, cellName, boxName);
var restAdapter = _pc.RestAdapterFactory.create(accessor);
var response = restAdapter.propfind(path);
var xmlContent = response.httpClient.responseText;
try {
return xmlContent.match(/subject=\"(.+?)\"/)[1];
} catch (e) {
return "";
}
}

For example, if xmlContent contains below text,

<p:service language="JavaScript" subject="" xmlns:p="urn:x-personium:xmlns" xmlns:D="DAV:" xmlns:Z="http://www.w3.com/standards/z39.50/">

then the regexp /subject=\"(.+?)\"/ matches with

" xmlns:p=

because it does not match empty string "" and matches all characters.

The erroneous match causes problems such as #156 (see the below code)

sb += "<p:service language=\"JavaScript\" subject=\"" + subject + "\">";

So, I modify the regexp to force not to match double-quotation (").

Could you review it? thanks.

@tochi-y tochi-y merged commit 40f7e59 into personium:master Jun 11, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants