@autobusal/common 1.4.3 → 1.4.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,5 +1,6 @@
1
1
  import { TFunction } from 'i18next';
2
2
  import { FiCalendar } from 'react-icons/fi';
3
+ import { sanitizeHtml } from '@autobusal/utilities';
3
4
  import Image from './Image';
4
5
  import { LinkTitle, Details, DisplayDate, TextPreview, TextView, ButtonLink } from './styles';
5
6
  import { ArticleData } from '@autobusal/providers/types/articles';
@@ -33,7 +34,7 @@ const BlogItem = ({ article, type, t }: Props): JSX.Element => (
33
34
  </TextPreview>
34
35
  ) }
35
36
 
36
- { type === 'view' && <TextView dangerouslySetInnerHTML={{ __html: article.content }} /> }
37
+ { type === 'view' && <TextView dangerouslySetInnerHTML={{ __html: sanitizeHtml(article.content) }} /> }
37
38
  </div>
38
39
  );
39
40
 
package/CHANGELOG.md CHANGED
@@ -3,6 +3,18 @@
3
3
  All notable changes to `@autobusal/common` are documented here. This project follows
4
4
  [Keep a Changelog](https://keepachangelog.com/) and [Semantic Versioning](https://semver.org/).
5
5
 
6
+ ## [1.4.5] - 2026-07-28
7
+
8
+ ### Fixed
9
+
10
+ - `File/File.tsx`: a `required` file-input field blocked saving ANY record that already had a file (image, document, etc.) unless the user re-uploaded it, since a file input can never carry over its previous value - the `required` rule now skips when a `value` (existing file URL) is already present. Found via a live sanity pass: this froze several existing records (e.g. a bus with a real image) out of being editable at all.
11
+
12
+ ## [1.4.4] - 2026-07-24
13
+
14
+ ### Fixed
15
+
16
+ - `BlogItem.tsx` and `Policy.tsx`: article/policy content is now run through `@autobusal/utilities`'s `sanitizeHtml` before being rendered via `dangerouslySetInnerHTML`, closing an XSS gap where an already-compromised admin account could persist JS in blog articles or policy pages.
17
+
6
18
  ## [1.4.3] - 2026-07-19
7
19
 
8
20
  ### Changed
package/File/File.tsx CHANGED
@@ -24,6 +24,13 @@ const File = ({ name, value, validation, multiple, t, refs }: Props): JSX.Elemen
24
24
 
25
25
  const rules = Validate(String(validation), t);
26
26
 
27
+ // a file input can never carry over its previous value (browsers won't let
28
+ // us set one), so `required` would otherwise force a re-upload just to save
29
+ // an unrelated field on a record that already has a file
30
+ if (value) {
31
+ delete rules.required;
32
+ }
33
+
27
34
  const onChange = (): void => {
28
35
  setUploaded(true);
29
36
  };
package/Policy/Policy.tsx CHANGED
@@ -1,4 +1,5 @@
1
1
  import { TFunction } from 'i18next';
2
+ import { sanitizeHtml } from '@autobusal/utilities';
2
3
  import Modal from '../Modal/Modal';
3
4
  import { useGetPolicy } from './services';
4
5
 
@@ -17,7 +18,7 @@ const Policy = ({ id, t, onClose }: Props): JSX.Element => {
17
18
  width={ 750 }
18
19
  title={ t('policy.title') }
19
20
  content={
20
- <div dangerouslySetInnerHTML={{ __html: data?.policies ?? '' }} />
21
+ <div dangerouslySetInnerHTML={{ __html: sanitizeHtml(data?.policies) }} />
21
22
  }
22
23
  onClose={ onClose }
23
24
  />
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@autobusal/common",
3
- "version": "1.4.3",
3
+ "version": "1.4.5",
4
4
  "author": "Ferjolt Ozuni",
5
5
  "type": "module",
6
6
  "main": "index.ts"