[Nottingham] Silly big attachments in ownCloud *Calendars*

Martin martin at ml1.co.uk
Wed Nov 26 16:27:24 UTC 2014


Folks,

Just had a bit of a giggle just now whereby a few 100MBytes of file
attachments were added into a calendar entry!...

The postgres database behind it was fine and looks to be fine up to
something like 1GByte for a database field. However, displaying the
calendars turned into something like watching the pitch flow experiment...

https://en.wikipedia.org/wiki/Pitch_drop_experiment


A quick fix was to remove any/all big offending attachments with a
sneaky bit of SQL:

update oc_clndr_objects set (calendardata, lastmodified) =
(regexp_replace(calendardata,'ATTACH;X-ORACLE-FILENAME=[^[:cntrl:]]+[[:cntrl:]]+(
[^[:cntrl:]]+[[:cntrl:]]+)+[[:cntrl:]]*','','g' ), lastmodified+60)
where char_length( calendardata ) > 8192 ;


Rather than blindly updating with that, a good check for what would be
zapped is to first run:

select char_length( calendardata ) as cdsize, calendarid, startdate,
substring(
regexp_replace(calendardata,'ATTACH;X-ORACLE-FILENAME=[^[:cntrl:]]+[[:cntrl:]]+(
[^[:cntrl:]]+[[:cntrl:]]+)+[[:cntrl:]]*','toberemoved','g' ) from
'toberemoved[^[:cntrl:]]+[[:cntrl:]]+' ) from oc_clndr_objects where
char_length( calendardata ) > 8192 order by cdsize;



Now... Other than trying to retrain humanity and computers... Or
continuously blindly repeating the sneaky fix...


Is there an easy fix to not have the silly big attachments accepted in
the first place?

Either on ownCloud, CALDAV, or postgres? Or all?


Cheers,
Martin

-- 
- ------------------ - ----------------------------------------
-    Martin Lomas    - OpenPGP (GPG/PGP) Public Key: 0xCEE1D3B7
- martin @ ml1 co uk - Import from   hkp://subkeys.pgp.net   or
- ------------------ - http:// ml1 .co .uk/martin_ml1_co_uk.gpg



More information about the Nottingham mailing list