My website is hosted in China and as you know all Chinese websites need to register for a license from the government, hence all Chinese websites are under supervision.
Someone recently reported to my CDN service provider, Qiniu, which is also a CN company, that some images on my website are illegal. My CDN provider informed me that I should delete these images and ‘refresh URL caches’, or they can suspend my account according to law. But I found these images were user avatars, which I don’t know how to delete.
According to How to Delete Uploaded Files? - #3 by codinghorror and How to Delete Uploaded Files? - #25 by Falco uploaded images w/o references will be auto deleted in 48 hours. I have replaced these user avatars with the default letter ones, but nothing seems to be happening to the old user avatars after 72 hours, maybe it’s because user avatars are not considered uploaded images?
Any ideas on how can I delete the user avatar files completely on my server?
Oh sorry. Avatars work differently. I would have to look at the code to understand where to look. If this is an emergency and you have a budget please contact me directly. I likely won’t have free time to investigate otherwise. Perhaps someone else knows.
To prevent users from uploading future avatars, you can disable allow uploaded avatars and enable the selectable avatars site setting with a large selection.
I think you may need to upload a replacement placeholder in order for automatic deletion - the user record is still keeping the uploaded avatar image alive even though it’s not in use.
Upload files are named based on the SHA1 of the image content - that may help you to find the backing file?
I have over 7k registered users and only less than 5 users use illegal avatars w/o knowing it, so I don’t want to make it a 0 or 1 problem; I want to solve it case by case rather than stopping all users from using custom avatars.
تلقّيتُ بريدًا إلكترونيًا آخر من مزوّد شبكة توصيل المحتوى (CDN) الخاص بي، وقد قام بتجميد حسابي على الشبكة. لذا، يجب أن أقوم بتحديث هذا الموضوع للحصول على مساعدة إضافية.
أشار البريد الإلكتروني الجديد إلى أن الروابط التالية غير قانونية:
كما تلاحظون، فهذه صورتا رمزين تعبيريين (أفاتار) لمستخدمين، وهما ميمز (memes) متعلقة برئيس صيني سابق. مرة أخرى، طلب مني مزوّد شبكة توصيل المحتوى حذف هذه الملفات من الخادم وتحديث شبكة توصيل المحتوى (CDN).
من خلال الروابط، لاحظت أن المستخدمين هما “baal998” و"lincwee". وفقًا لمقطع الكود في منشوري السابق، كان عنوان URL للصورة المرفوعة لـ “lincwee” هو /uploads/default/original/2X/5/55512211b1c8969c8038b79840464952cd3eb089.jpeg، بينما كان لـ “baal998” هو /uploads/default/original/2X/c/cb2188eaeecc3a648f021fa00da4734bd60ca183.jpg. ثم قمت بتشغيل الأمر find /var/discourse/shared/ -name *55512211b1c8969c8038b79840464952cd3eb089* وحذفت جميع الملفات التي تم العثور عليها، وقد نجح الأمر مع “lincwee”. لكن لم أكن محظوظًا مع “baal998”، إذ ما زلتُ أستطيع الوصول إلى https://iosre.com/user_avatar/iosre.com/baal998/135/2210_2.png رغم عدم وجود أي ملفات تحمل الاسم *cb2188eaeecc3a648f021fa00da4734bd60ca183*.
أيضًا، ابدأ بجلب البيانات من خادمك وليس من شبكة توصيل المحتوى (CDN). تريد التأكد من أنك تحل المشكلة في المكان الصحيح. بمجرد التأكد من أن الخادم لا يرسل الصور، يمكنك العمل مع شبكة توصيل المحتوى (CDN).