Web platform for sharing free image data for ML and research

Homepage: https://datasets.roundabout-host.com

By using this site, you agree to have cookies stored on your device, strictly for functional purposes, such as storing your session and preferences.

Dismiss

Fix replacing a picture also affecting copies/originals

roundabout,
created on Sunday, 16 February 2025, 10:06:10 (1739700370), received on Sunday, 16 February 2025, 10:06:14 (1739700374)
Author identity: vlad <vlad.muntoiu@gmail.com>

d347af4001fa418d7d12346c59d782458748f0c2

app.py

@@ -944,7 +944,8 @@ def put_file_post(id):

                                
                                
                                
                            
                                
                                    
                                        
                                            
                                                    return flask.redirect(flask.request.url)
                                        
                                        
                                            
                                            
                                            
                                            
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                            
                                            
                                        
                                        
                                            
                                            
                                            
                                            
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                            
                                                file_path = path.join(config.DATA_PATH, "pictures", str(resource.id))
                                        
                                        
                                            
                                            
                                            
                                            
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                            print(file_path)
                                        
                                        
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                            # Since it's a hard link, we need to remove it, so it won't affect copies
                                        
                                        
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                            os.unlink(file_path)
                                        
                                        
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                            
                                                file.save(file_path)
                                        
                                        
                                            
                                            
                                            
                                            
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                            
                                                pil_image = Image.open(file_path)
                                        
                                        
                                            
                                            
                                            
                                            
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                            
                                                resource.width, resource.height = pil_image.size
                                        
                                        
                                            
                                            
                                            
                                            
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        

@@ -1766,6 +1767,8 @@ def api_put_file(id):

                                
                                
                                
                            
                                
                                    
                                        
                                            
                                                    return flask.jsonify({"error": "Only images are supported"}), 400
                                        
                                        
                                            
                                            
                                            
                                            
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                            
                                            
                                        
                                        
                                            
                                            
                                            
                                            
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                            
                                                file_path = path.join(config.DATA_PATH, "pictures", str(resource.id))
                                        
                                        
                                            
                                            
                                            
                                            
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                            # Since it's a hard link, we need to remove it, so it won't affect copies
                                        
                                        
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                            os.unlink(file_path)
                                        
                                        
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                            
                                                file.save(file_path)
                                        
                                        
                                            
                                            
                                            
                                            
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                            
                                                pil_image = Image.open(file_path)
                                        
                                        
                                            
                                            
                                            
                                            
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                            
                                                resource.width, resource.height = pil_image.size