mirror of
https://github.com/xuthus83/pigallery2.git
synced 2024-11-03 21:04:03 +08:00
Added a test for offset-fix and found another bug - also fixed
This commit is contained in:
parent
f8021348db
commit
7411750ffd
@ -144,11 +144,11 @@ export class Utils {
|
|||||||
//function to extract offset string from timestamp string, returns undefined if timestamp does not contain offset
|
//function to extract offset string from timestamp string, returns undefined if timestamp does not contain offset
|
||||||
static timestampToOffsetString(timestamp: string) {
|
static timestampToOffsetString(timestamp: string) {
|
||||||
try {
|
try {
|
||||||
const idx = timestamp.indexOf("+");
|
const offsetRegex = /[+-]\d{2}:\d{2}$/;
|
||||||
if (idx > 0) {
|
var match = timestamp.match(offsetRegex);
|
||||||
return timestamp.substring(idx, timestamp.length);
|
if (match) {
|
||||||
}
|
return match[0];
|
||||||
if (timestamp.indexOf("Z") > 0) {
|
} else if (timestamp.indexOf("Z") > 0) {
|
||||||
return '+00:00';
|
return '+00:00';
|
||||||
}
|
}
|
||||||
return undefined;
|
return undefined;
|
||||||
|
BIN
test/backend/assets/wild-2-small.jpg
Normal file
BIN
test/backend/assets/wild-2-small.jpg
Normal file
Binary file not shown.
After Width: | Height: | Size: 61 KiB |
BIN
test/backend/assets/wild-2-small.jpg_original
Normal file
BIN
test/backend/assets/wild-2-small.jpg_original
Normal file
Binary file not shown.
After Width: | Height: | Size: 61 KiB |
20
test/backend/assets/wild-2-small.json
Normal file
20
test/backend/assets/wild-2-small.json
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
{
|
||||||
|
"size": {
|
||||||
|
"width": 306,
|
||||||
|
"height": 204
|
||||||
|
},
|
||||||
|
"creationDate": 1435943085000,
|
||||||
|
"fileSize": 62306,
|
||||||
|
"positionData": {
|
||||||
|
"country": "United States",
|
||||||
|
"state": "Arizona",
|
||||||
|
"city": "Williams"
|
||||||
|
},
|
||||||
|
"keywords": ["Akela the wolf", "Balu the bear", "Bearizona", "Hugin the raven", "USA", "USA Road trip"],
|
||||||
|
"cameraData": {
|
||||||
|
"make": "Canon",
|
||||||
|
"model": "Canon EOS 600D",
|
||||||
|
"lens": "EF-S15-85mm f/3.5-5.6 IS USM"
|
||||||
|
},
|
||||||
|
"creationDateOffset": "-07:00"
|
||||||
|
}
|
@ -179,6 +179,11 @@ describe('MetadataLoader', () => {
|
|||||||
const expected = require(path.join(__dirname, '/../../../assets/wild-1-small.json'));
|
const expected = require(path.join(__dirname, '/../../../assets/wild-1-small.json'));
|
||||||
expect(Utils.clone(data)).to.be.deep.equal(expected);
|
expect(Utils.clone(data)).to.be.deep.equal(expected);
|
||||||
});
|
});
|
||||||
|
it('should load wild-2-small image with xmp-CreateDate from 2015 and negative offset', async () => {
|
||||||
|
const data = await MetadataLoader.loadPhotoMetadata(path.join(__dirname, '/../../../assets/wild-2-small.jpg'));
|
||||||
|
const expected = require(path.join(__dirname, '/../../../assets/wild-2-small.json'));
|
||||||
|
expect(Utils.clone(data)).to.be.deep.equal(expected);
|
||||||
|
});
|
||||||
|
|
||||||
describe('should load jpg with edge case exif data', () => {
|
describe('should load jpg with edge case exif data', () => {
|
||||||
const root = path.join(__dirname, '/../../../assets/edge_case_exif_data');
|
const root = path.join(__dirname, '/../../../assets/edge_case_exif_data');
|
||||||
|
Loading…
Reference in New Issue
Block a user