Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
C
coopwire-hypothesis
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
孙灵跃 Leon Sun
coopwire-hypothesis
Commits
f2c7c707
Commit
f2c7c707
authored
Jun 09, 2016
by
Robert Knight
Committed by
GitHub
Jun 09, 2016
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #3441 from hypothesis/sheetaluk/pdf-metadata
Remove path for local pdf files.
parents
7e95361d
99c69180
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
26 additions
and
2 deletions
+26
-2
pdf-metadata.js
h/static/scripts/annotator/plugin/pdf-metadata.js
+8
-2
pdf-metadata-test.js
h/static/scripts/annotator/plugin/test/pdf-metadata-test.js
+18
-0
No files found.
h/static/scripts/annotator/plugin/pdf-metadata.js
View file @
f2c7c707
...
...
@@ -49,10 +49,16 @@ PDFMetadata.prototype.getMetadata = function () {
}
var
link
=
[
{
href
:
fingerprintToURN
(
app
.
documentFingerprint
)},
{
href
:
app
.
url
}
{
href
:
fingerprintToURN
(
app
.
documentFingerprint
)}
];
// Local file:// URLs should not be saved in document metadata.
// Entries in document.link should be URIs. In the case of
// local files, omit the URL.
if
(
app
.
url
.
indexOf
(
'file://'
)
!==
0
)
{
link
.
push
({
href
:
app
.
url
});
}
return
{
title
:
title
,
link
:
link
,
...
...
h/static/scripts/annotator/plugin/test/pdf-metadata-test.js
View file @
f2c7c707
...
...
@@ -83,6 +83,24 @@ describe('pdf-metadata', function () {
assert
.
deepEqual
(
actualMetadata
,
expectedMetadata
);
});
});
it
(
'does not save file:// URLs in document metadata'
,
function
()
{
var
pdfMetadata
;
var
fakePDFViewerApplication
=
{
documentFingerprint
:
'fakeFingerprint'
,
url
:
'file://fakeUrl'
,
};
var
expectedMetadata
=
{
link
:
[{
href
:
'urn:x-pdf:'
+
fakePDFViewerApplication
.
documentFingerprint
}],
};
pdfMetadata
=
new
PDFMetadata
(
fakePDFViewerApplication
);
return
pdfMetadata
.
getMetadata
().
then
(
function
(
actualMetadata
)
{
assert
.
equal
(
actualMetadata
.
link
.
length
,
1
);
assert
.
equal
(
actualMetadata
.
link
[
0
].
href
,
expectedMetadata
.
link
[
0
].
href
);
});
});
});
});
});
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment