Skip to content

Commit

Permalink
Merge branch 'main' into users/amitjoshi/ariaLabelForCopilotPanel
Browse files Browse the repository at this point in the history
  • Loading branch information
amitjoshi438 authored Dec 23, 2024
2 parents e5ad385 + ebbb521 commit 10ae216
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 7 deletions.
9 changes: 7 additions & 2 deletions src/web/client/dal/remoteFetchProvider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -246,11 +246,16 @@ async function createContentFiles(
schemaEntityKey.LANGUAGE_FIELD
);

let languageCode = WebExtensionContext.websiteLanguageCode;

if (languageCodeAttribute && result[languageCodeAttribute] === null) {
throw new Error(ERROR_CONSTANTS.LANGUAGE_CODE_ID_VALUE_NULL);
if (entityName !== schemaEntityName.CONTENTSNIPPETS) {
throw new Error(ERROR_CONSTANTS.LANGUAGE_CODE_ID_VALUE_NULL);
} else {
languageCode = Constants.DEFAULT_LANGUAGE_CODE; // Handles the case where language code is null for content snippets
}
}

let languageCode = WebExtensionContext.websiteLanguageCode;
if (defaultFileInfo?.fileName === undefined &&
languageCodeAttribute &&
result[languageCodeAttribute]) {
Expand Down
4 changes: 2 additions & 2 deletions src/web/client/schema/portalSchema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ export const portal_schema_V1 = {
_fetchQueryParameters:
"?$filter=adx_contentsnippetid eq {entityId}&$select=adx_name,adx_value,_adx_contentsnippetlanguageid_value",
_multiFileFetchQueryParameters:
"?$filter=_adx_websiteid_value eq {websiteId} and _adx_contentsnippetlanguageid_value ne null &$select=adx_name,adx_value,adx_contentsnippetid,_adx_contentsnippetlanguageid_value&$count=true",
"?$filter=_adx_websiteid_value eq {websiteId} &$select=adx_name,adx_value,adx_contentsnippetid,_adx_contentsnippetlanguageid_value&$count=true",
_attributes: "adx_value",
_attributesExtension: new Map([["adx_value", "html"]]),
},
Expand Down Expand Up @@ -334,7 +334,7 @@ export const portal_schema_V2 = {
_fetchQueryParameters:
"?$filter=powerpagecomponentid eq {entityId}&$select=name,content",
_multiFileFetchQueryParameters:
"?$filter=_powerpagesiteid_value eq {websiteId} and powerpagecomponenttype eq 7 and _powerpagesitelanguageid_value ne null &$select=name,content,_powerpagesitelanguageid_value&$count=true",
"?$filter=_powerpagesiteid_value eq {websiteId} and powerpagecomponenttype eq 7 &$select=name,content,_powerpagesitelanguageid_value&$count=true",
_attributes: "content.value",
_attributesExtension: new Map([["content.value", "html"]]),
},
Expand Down
10 changes: 7 additions & 3 deletions src/web/client/utilities/commonUtil.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import { doesFileExist, getFileAttributePath, getFileEntityName, updateEntityCol
import { isWebFileV2 } from "./schemaHelperUtil";
import { ServiceEndpointCategory } from "../../../common/services/Constants";
import { PPAPIService } from "../../../common/services/PPAPIService";
import * as Constants from "../common/constants";

// decodes file content to UTF-8
export function convertContentToUint8Array(content: string, isBase64Encoded: boolean): Uint8Array {
Expand All @@ -42,15 +43,18 @@ export function GetFileNameWithExtension(
languageCode: string,
extension: string
) {
fileName = isLanguageCodeNeededInFileName(entity) ? `${fileName}.${languageCode}` : fileName;
if (entity === schemaEntityName.CONTENTSNIPPETS) {
fileName = languageCode && languageCode != Constants.DEFAULT_LANGUAGE_CODE ? `${fileName}.${languageCode}` : fileName; // Handle the case where language is not provided for content snippets
} else {
fileName = isLanguageCodeNeededInFileName(entity) ? `${fileName}.${languageCode}` : fileName;
}
fileName = isExtensionNeededInFileName(entity) ? `${fileName}.${extension}` : fileName;

return getSanitizedFileName(fileName);
}

export function isLanguageCodeNeededInFileName(entity: string) {
return entity === schemaEntityName.WEBPAGES ||
entity === schemaEntityName.CONTENTSNIPPETS;
return entity === schemaEntityName.WEBPAGES ||entity === schemaEntityName.CONTENTSNIPPETS;
}

export function isExtensionNeededInFileName(entity: string) {
Expand Down

0 comments on commit 10ae216

Please sign in to comment.