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

fix preserve logic for titleLang #2653

Merged
merged 4 commits into from
Apr 22, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 12 additions & 13 deletions packages/cli/src/lib/setup/setupUpload.ts
Original file line number Diff line number Diff line change
Expand Up @@ -260,8 +260,8 @@ export class Upload {
/**
* Uploads a file
*
* @param source
* @param target
* @param source source path
* @param target target path
*/
async uploadFile(source: string, target: string): Promise<string> {
target = target.replace(/\\/g, '/');
Expand Down Expand Up @@ -483,11 +483,11 @@ export class Upload {
/**
* Upload given adapter
*
* @param adapter
* @param isAdmin
* @param forceUpload
* @param subTree
* @param _logger
* @param adapter adapter name
* @param isAdmin if admin folder should be uploaded too
* @param forceUpload if upload should be forced
* @param subTree subtree path to upload
* @param _logger logger instance
*/
async uploadAdapter(
adapter: string,
Expand Down Expand Up @@ -576,8 +576,7 @@ export class Upload {
});
}
// Set indicator to 0
// @ts-expect-error fixed with #1917
await this.states.setStateAsync(uploadID, 0, true);
await this.states.setState(uploadID, { val: 0, ack: true });
}

let result;
Expand Down Expand Up @@ -669,7 +668,7 @@ export class Upload {

for (const [attr, attrData] of Object.entries(additional)) {
// preserve these attributes, except, they were undefined before and preserve titleLang if current titleLang is of type string (changed by user)
if (preserveAttributes.includes(attr) || (attr === 'titleLang' && typeof attrData === 'string')) {
if (preserveAttributes.includes(attr) || (attr === 'titleLang' && typeof target[attr] === 'string')) {
Apollon77 marked this conversation as resolved.
Show resolved Hide resolved
if (target[attr] === undefined) {
target[attr] = attrData;
}
Expand Down Expand Up @@ -792,9 +791,9 @@ export class Upload {
/**
* Create object from io-package json
*
* @param name
* @param ioPack
* @param logger
* @param name adapter name
* @param ioPack IoPack content
* @param logger logger instance
*/
async upgradeAdapterObjects(
name: string,
Expand Down
Loading