1
0
mirror of https://github.com/bpatrik/pigallery2.git synced 2025-03-11 14:59:21 +02:00

Loading default settings before evaluating MetadataLoader

This commit is contained in:
Patrik J. Braun 2021-05-11 15:57:36 +02:00
parent 032a5f4863
commit 4ab1f558d1
4 changed files with 9 additions and 5 deletions

View File

@ -15,5 +15,6 @@ before_install:
- google-chrome-stable --headless --disable-gpu --remote-debugging-port=9222 http://localhost &
install:
- npm ci
- npm run lint
- npm run build
after_success: npm run coverage

View File

@ -216,13 +216,13 @@ export class MetadataLoader {
if (exif.Rating) {
metadata.rating = (parseInt(exif.Rating.value, 10) as any);
}
if(exif.subject && exif.subject.value && exif.subject.value.length > 0){
if(metadata.keywords == undefined) {
if (exif.subject && exif.subject.value && exif.subject.value.length > 0) {
if (metadata.keywords == undefined) {
metadata.keywords = [];
}
for(let i=0; i < exif.subject.value.length; i++){
for (let i = 0; i < exif.subject.value.length; i++) {
const kw = exif.subject.value[i].description;
if(metadata.keywords.indexOf(kw) == -1) {
if (metadata.keywords.indexOf(kw) == -1) {
metadata.keywords.push(kw);
}
}

View File

@ -30,7 +30,7 @@ describe('SettingsRouter', () => {
});
describe('/GET settings', () => {
it('it should GET all the books', async () => {
it('it should GET the settings', async () => {
Config.Client.authenticationRequired = false;
const originalSettings = await Config.original();
originalSettings.Server.sessionSecret = null;

View File

@ -4,8 +4,11 @@ import {Utils} from '../../../../../src/common/Utils';
import * as path from 'path';
import * as fs from 'fs';
import {PhotoProcessing} from '../../../../../src/backend/model/fileprocessing/PhotoProcessing';
import {Config} from '../../../../../src/common/config/private/Config';
describe('MetadataLoader', () => {
// loading default settings (this might have been changed by other tests
Config.loadSync();
it('should load png', async () => {
const data = await MetadataLoader.loadPhotoMetadata(path.join(__dirname, '/../../../assets/test_png.png'));